Michelle Michy
Member
- Local time
 - Today, 04:14
 
- Joined
 - May 11, 2023
 
- Messages
 - 46
 
Hi all. In my research over the web I found the following function. I don't know how to call it in a module or submodule. Any assistance will be highly appreciated. I want my access database application to be used by only one computer.
	
	
	
		
 
		Code:
	
	
	Public Function LDSerialFSO(DriveLetter As String) As Variant
On Error GoTo errHandler
Dim objFSO As Object
Dim objDrv As Object
Dim strSN As Variant
DriveLetter = Left(DriveLetter,1) & ":"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDrv = objFSO.GetDrive(DriveLetter)
If objDrv.IsReady Then
    strSN = objDrv.SerialNumber
Else
    strSN = Null
End If
    
LDSerialFSO = strSN
errExit:
    Set objFSO = Nothing
    Exit Function
    
errHandler:
    MsgBox Err.Number & ". " & Err.Description
    Resume errExit
    
End Function