Try this modified code. Note, comparisson operators changed in line#12.
Code:
Private Function ValidateTimeSlot() As Variant
With Me
If IsNull(.StartTime) Or IsNull(.EndTime) Or _
IsNull(.Stylist) Or IsNull(.[Appt Date]) Then
ValidateTimeSlot = Null
Exit Function
End If
If DCount("ID", "[Your table name]", _
"((StartTime>#" & .StartTime & "# And StartTime<#" & .EndTime & _
"#) Or (EndTime>#" & .StartTime & "# And EndTime<#" & .EndTime & _
"#) Or (StartTime<=#" & .StartTime & "# And EndTime=>#" & .EndTime & _
"#)) AND Stylist=" & .Stylist & _
" AND [Appt Date] = #" & .[Appt Date] & "#")<>0 Then
MsgBox ("time interval bla bla bla")
ValidateTimeSlot = False
Else
ValidateTimeSlot = True
End If
End With
End Function
Thanks FishVal!
Its working great now! Thanks ever so much for your help!
Comment