I want to protect my database from copy to another computer. Is it posible to put some data in windows registry and database to look for that data on startup and if there is no that data in the registry to display some note and stop working?
Please help
We have managed to achieve this in a slightly more simple way. Basically, I took our company logo & renamed it to a .sys file. I then set it to have hidden & system attributes & moved it into the winnt\system32 folder. On startup, our database checks to see if this file exists. If it does it will continue to load, otherwise it will boot the person out. This works fine, as long as the end users do not get access to the code. If they get access to the code, they can easily see where this file lies. However, doing what you suggested would produce the same problem.
e.g
Create a module with a file checking function something like the following:
' Declare call to kernel32.exe to use the openfile to check file
' existence ( Access DIR function can fail when using UNC for server/share names )
Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, _
lpReOpenBuff As OFSTRUCT, _
ByVal wStyle As Long) As Long
' Declare constants for passing to openfile
Public Const OFS_MAXPATHNAME = 128
Public Const OF_EXIST = &H4000
' Declare object used in openfile function
Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type
Function CheckFileExists(ByVal IN_FILENAME As String) As Integer
Dim iresult As Integer
Dim strucFname As OFSTRUCT
Dim strSearchFile As String
'The above line causes OpenFile to search for the
'file Test on the server network path.
'Passing the OF_EXIST parameter tells the OpenFile
'function to search for the file, the file will not be
'opened or modified in any way.
CheckFileExists = iresult
End Function
Run a splash form on startup & add the following code to its on_open event:
If CheckFileExists("Path & FileName" <> 1 Then
MsgBox "Say something nasty here", vbCritical
DoCmd.Quit
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.