Hi guys
I am using this function to protect the database from copying and transferring it to another computer. And it works very well. But the problem I am facing is that I have to open a window (VBA) to put the Board Maker Serial Number for the program to work. Is there a way to create a table and put the Serial Number of the Board Maker?
Thank you very much
I am using this function to protect the database from copying and transferring it to another computer. And it works very well. But the problem I am facing is that I have to open a window (VBA) to put the Board Maker Serial Number for the program to work. Is there a way to create a table and put the Serial Number of the Board Maker?
Thank you very much
Code:
Public Function GetSetComputerSerial()
Dim prop As DAO.Property
Dim dbs As DAO.Database
On Error GoTo err_handler
Dim strPCLocker As String
Set dbs = CurrentDb
'Set the property's value
'If it doesn't exist, an error 3270 "Property not found" will occur
strPCLocker = dbs.Containers("Databases")("UserDefined").Properties("YB01xxxxx288").Value
If strPCLocker = "_$_" Then
strPCLocker = GetComputerSerial()
dbs.Containers("Databases")("UserDefined").Properties("YB01xxxxx88").Value = strPCLocker
End If
If Err.Number = 0 Then
If strPCLocker <> GetComputerSerial() & "" Then
MsgBox "Check the database manager" & vbCrLf & vbCrLf & _
"This database cannot be copied to this computer.", vbOKOnly + vbExclamation
Application.Quit
End If
End If
Set prop = Nothing
Set dbs = Nothing
Exit Function
err_handler:
If Err = 3270 Then
'If the property doesn't exist, create it
Set prop = dbs.CreateProperty("YB01xxxxx88", dbText, GetComputerSerial() & "")
'Append it to the collection
dbs.Containers("Databases")("UserDefined").Properties.Append prop
End If
Resume
End Function