|
|
CODE ' Code courtesy of UtterAccess Wiki ' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary ' Original submission by Pacala_Ba ' 2010, August 11th ' ' You are free to use it in any application, ' provided this copyright notice is left unchanged. ' ' ' --------------------- Example calls ----------------- '? Sys_AC_VerifyDriveExists(gkc_DriveBackEnd,"BackEnd",bAC_Quit:=False) ' ' 'Example Constants used to for arguments 'Public Const gkc_DriveFrontEnd = "C" ' DATABASE CONTROLS WITHOUT TABLES 'Public Const gkc_DriveTempEnd = "D" ' DATABASE USER TEMPORARY TABLES 'Public Const gkc_DriveBackEnd = "Z" ' DATABASE TABLES 'Public Const gkc_DriveUserEnd = "Z" ' DATABASE SECURE WorkgroupFile ' ' Public Function Sys_AC_VerifyDriveExists(cDrive As String, _ Optional cMsgText As String = "", _ Optional bAC_Quit As Boolean = False, _ Optional cNote As String = "Input: Drive/Path") As Boolean On Error GoTo LBL_xPAC_ERR Dim ll_Ret As Boolean, lcDrive As String, oFS As Object lcDrive = Trim$(Left$(cDrive, 1)) If Len(lcDrive) = 0 Then Err.Raise 1000, "Sys_AC_VerifyDriveExists", "Drive name is **EMPTY** !" Else Set oFS = CreateObject("Scripting.FileSystemObject") ll_Ret = oFS.DriveExists(lcDrive) If Not ll_Ret Then MsgBox "'" & cDrive & "', Drive **NOT EXISTS** !" & vbCrLf & cMsgText, _ vbCritical, "Sys_AC_VerifyDriveExists" If bAC_Quit Then Application.Quit End If End If End If LBL_xPAC_END: Set oFS = Nothing Sys_AC_VerifyDriveExists = ll_Ret Exit Function LBL_xPAC_ERR: MsgBox "Err: " & Err & "," & Err.Description, vbCritical, "Sys_AC_VerifyDriveExists" Resume LBL_xPAC_END Resume Next Resume End Function
|
| This page has been accessed 1,293 times. This page was last modified 09:43, 6 April 2011 by Jack Leach. Disclaimers |