I backup my back-end database to a computer's published drive on a network. Sometimes, however, this computer is off-line and therefore my backup procedure fails because the specified path does not exists.
This is the backup path: \\DELL800W7\Data2\Backups\MiltonHPlaptop
I know how to check if a drive letter exists, i.e. D:,E:, F: but can't seem to get code to verify \\DELL800W7\Data2\Backups\MiltonHPlaptop path.
This is the code I'm using to find out if a drive exists:
Public Function f_DriveExists(DirectoryPath As String) As Boolean Dim objFS As Object On Error GoTo ErrorTrap 'Assume it does not f_DriveExists = False Set objFS = CreateObject("Scripting.FileSystemObject") 'DriveExists returns True or False f_DriveExists = objFS.DriveExists(DirectoryPath) ExitPoint: Exit Function ErrorTrap: MsgBox "f_DriveExists: " & Err.Description, vbExclamation, "Error" f_DriveExists = False GoTo ExitPoint End Function





Reply With Quote