cleteh
07-18-2016, 01:27 PM
In Access 1997 the following code errors out on the line in red
Private Sub Form_Open(Cancel As Integer)
If [SystemDate].max[SystemDate] = Date() Then
Else
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO SystemDate (SystemDate) VALUES (Date());"
DoCmd.SetWarnings True
End If
End Sub
I am checking if the most recent date in a table matches today's date... if it does do nothing. Else insert today's date into the table. It I remove the first 2 lines it does enter today's date into the table.
Private Sub Form_Open(Cancel As Integer)
If [SystemDate].max[SystemDate] = Date() Then
Else
DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO SystemDate (SystemDate) VALUES (Date());"
DoCmd.SetWarnings True
End If
End Sub
I am checking if the most recent date in a table matches today's date... if it does do nothing. Else insert today's date into the table. It I remove the first 2 lines it does enter today's date into the table.