This might be more a windows problem than Access but I post it here on the off chance.
While working on my database from home, I log into a remote server via a VPN.
I have two drives mapped to the server and when I connect, neither drive is active until I open them via file explorer.
I use the following code to detect any drives with particular folders to set the paths for the database.
So if either, or both drives are inactive, albeit connected, oFSO fails to detect them and my paths are incorrect.
"oFSO" is a public function in a module.
While working on my database from home, I log into a remote server via a VPN.
I have two drives mapped to the server and when I connect, neither drive is active until I open them via file explorer.
I use the following code to detect any drives with particular folders to set the paths for the database.
So if either, or both drives are inactive, albeit connected, oFSO fails to detect them and my paths are incorrect.
"oFSO" is a public function in a module.
Code:
Private Sub getDrives()
' tempvars!drive is any removable drive.
' tempvars!Patha is the network drive that holds image files and other documents.
' tempvars!Pathb is the network drive that holds the back-end files and individual front-end files.
Dim sDrive As Object
For Each sDrive In oFSO.Drives
If oFSO.FolderExists(sDrive & "\Images") Then
If sDrive.DriveType = 2 Then
TempVars!Drive = sDrive & "\"
ElseIf sDrive.DriveType = 3 Then
TempVars!PathA = sDrive & "\"
End If
End If
If sDrive.DriveType = 3 And oFSO.FolderExists(sDrive & "\Split") Then
TempVars!PathB = sDrive & "\"
End If
Next
End Sub