Create directories under the same path of the database
If you need to create a directory under the same path of your database, use the following code:
Dim strPath As String
strPath = CurrentProject.Path & "\MyFolder" 'Replace MyFolder with the name of the folder you wish to create
'Is the directory created? This step is necessary in order to avoid an error
If Dir(strPath, vbDirectory) = "" Then
MkDir strPath 'The MkDir command is used to create the folder
End If
'Is the workorder dir created?
strPath = strPath & "\" & Me.WorkorderID
If Dir(strPath) = "" Then
MkDir strPath
End If
We hope this codehelps you out, and if you get stuck give us a call, we help clients throughout the USA with Access problems.