K
Kman
Hi,
I am trying to validate that a record doesn't exist in a table before saving
using a dlookup function, however I keep getting a "type mismatch" on
runtime. Can anyone help, here is the code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strWhere As String
Dim varResult As Variant
varResult = DLookup("TimeOn", "TimeOn", "EmployeeID = " &
Forms!ClockOn!EmployeeID _
& " AND DateIn =#" & Forms!ClockOn!DateIn & "#")
If IsNull(varResult) Then
MsgBox "Your Time On record has been successfully recorded", vbOK
'Cancel = True
'Me.Undo
End If
End Sub
Any assistance greatly appreciated.
I am trying to validate that a record doesn't exist in a table before saving
using a dlookup function, however I keep getting a "type mismatch" on
runtime. Can anyone help, here is the code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strWhere As String
Dim varResult As Variant
varResult = DLookup("TimeOn", "TimeOn", "EmployeeID = " &
Forms!ClockOn!EmployeeID _
& " AND DateIn =#" & Forms!ClockOn!DateIn & "#")
If IsNull(varResult) Then
MsgBox "Your Time On record has been successfully recorded", vbOK
'Cancel = True
'Me.Undo
End If
End Sub
Any assistance greatly appreciated.