M
margaret
I have a form and I would like a message box to appear if there is a
duplicate value using two different controls ... emp and boothdate. This is
what I have:
Private Sub boothdate_BeforeUpdate(Cancel As Integer)
Dim varboothdate As Variant
If IsNull(Me.emp) Or IsNull(Me.boothdate) Then
CheckDuplicates = False
Else
varboothdate = DLookup("emp", "[tblemp booth assignment]", _
"emp = " & Me.emp & " AND boothdate = " & Me.boothdate)
If Not IsNull(varboothdate) Then
MsgBox "Employee is already assigned on that date. Verify Employee and
booth date."
CheckDuplicates = True
Else
CheckDuplicates = False
End If
End If
End Sub
It's not working. I'm not getting an error or anything. Any help would be
appreciated.
duplicate value using two different controls ... emp and boothdate. This is
what I have:
Private Sub boothdate_BeforeUpdate(Cancel As Integer)
Dim varboothdate As Variant
If IsNull(Me.emp) Or IsNull(Me.boothdate) Then
CheckDuplicates = False
Else
varboothdate = DLookup("emp", "[tblemp booth assignment]", _
"emp = " & Me.emp & " AND boothdate = " & Me.boothdate)
If Not IsNull(varboothdate) Then
MsgBox "Employee is already assigned on that date. Verify Employee and
booth date."
CheckDuplicates = True
Else
CheckDuplicates = False
End If
End If
End Sub
It's not working. I'm not getting an error or anything. Any help would be
appreciated.