Avatar of SteveL13
SteveL13
Flag for United States of America

asked on 

How create a folder on a server with the PK as the folder name

I have a main form (the first form that opens with this onload event:

Private Sub Form_Load()
On Error GoTo Err_Form_Load

    Dim strAttachmentDirectory As String
   
    strAttachmentDirectory = DLookup("AttachmentDirectory", "LOCALtblDatabaseSetup")
    If Not Right(strAttachmentDirectory, 1) = "\" Then strAttachmentDirectory = strAttachmentDirectory & "\"
    TempVars!strAttachmentDirectory = strAttachmentDirectory

Exit_Form_Load:
    Exit Sub

Err_Form_Load:
    MsgBox "Error Number: " & Err.Number & vbCrLf & "Error Description: " & Err.Description & vbCrLf & "Error Source: " & Err.Source
    Resume Exit_Form_Load
End Sub

Which I believe is establishing the name of the folder I want on the C: drive.

But then within that established folder I want another folder to be setup using the PK on another form when a command button is clicked AND have an explorer window open to that newly established folder.  So there will end up being separate folders for each PK.  

If the folder was already setup by a previous onclick event I want the explorer window to open to it.

How can I do this?
Microsoft Access

Avatar of undefined
Last Comment
PatHartman

8/22/2022 - Mon