I am running this code in a hidden validation form and trying to compare dates (registered, date db was last accessed and the system date of the PC). I can't seem to get the check tampering code working. I've been staring at this for far too long and I guess I'm overlooking something. Any help is appreciated.
Code:
strSQL = "SELECT * FROM tblColors WHERE [SerialHDD] = '" & strHDD & " '"
Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
If rs.EOF = True Then
MsgBox "It appears that you are not registered. Opening registration form."
DoCmd.OpenForm "frmRegister", acNormal, , , acFormEdit, acWindowNormal
DoCmd.Close acForm, "frmValidate"
Exit Sub 'once user has completed registration, open this form again
Else
'check tampering - did the user roll back his PC clock
If CLng(Date) < CLng(rs!DateLastAccessed) Then
MsgBox "It appears that the database has been tampered with. Please contact support."
Call dbTamper
DoCmd.Close
End If
'check tampering - did the user roll back date accessed in local table
If CLng(rs!DateRegistered) > CLng(rs!DateLastAccessed) Then
MsgBox "It appears that the database has been tampered with. Please contact support."
Call dbTamper
DoCmd.Close
End If
End If
Comment