I have a form attached to DB "Data" My data includes 5 time slots (SlotID) to add appointments. Those same 5 slots are filled on a daily basis. Before the user enters an appointment I want to check to see if there is already an appointment on the same day in that time slot so that appointments are not double booked.
Here is my code - I am receiving a Run-time error 3464 - data type mismatch. If I eliminate the 2nd criteria, (the date) it works in identifying records in the same slot but it finds them on ALL days of course. What is wrong with this syntax?
Private Sub cmbSlotID_Change()
If Me.cmbSlotID.Value = DLookup("[SlotID]", "Data", "[SlotID] ='" & Me.cmbSlotID & "'") AND _
Me.txtStart_Date = DLookup("[Start Date]", "Data", "[Start Date] ='" & Me.txtStart_Date & "'") _
Then MsgBox "This timeslot is alread filled."
End Sub
Thanks in advance!!!
-Tim