|
|
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_VerifyDriveIsReady(gkc_DriveBackEnd,"BackEnd",bAC_Quit:=False) ' ' 'Example constants to use 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_VerifyDriveIsReady(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 Dim oFS As Object, oDrive As Object lcDrive = Trim$(Left$(cDrive, 1)) If Len(lcDrive) = 0 Then Err.Raise 1000, "Sys_AC_VerifyDriveIsReady", "Drive name is **EMPTY** !" Else Set oFS = CreateObject("Scripting.FileSystemObject") Set oDrive = oFS.GetDrive(UCase$(lcDrive)) ll_Ret = oDrive.IsReady If Not ll_Ret Then MsgBox "'" & cDrive & "', Drive is **NOT READY** !" & vbCrLf & cMsgText, _ vbCritical, "Sys_AC_VerifyDriveIsReady" If bAC_Quit Then Application.Quit End If End If End If LBL_xPAC_END: Set oFS = Nothing Set oDrive = Nothing Sys_AC_VerifyDriveIsReady = ll_Ret Exit Function LBL_xPAC_ERR: MsgBox "Err: " & Err & "," & Err.Description, vbCritical, "Sys_AC_VerifyDriveIsReady" Resume LBL_xPAC_END Resume Next Resume End Function
|
| This page was last modified 09:43, 6 April 2011. This page has been accessed 743 times. Disclaimers |