Is it possible if what I would like to accomplish is to rule out duplicate value. With a form with two fields one is a date field formatted as short date and the other is a lookup combo box that I use to lookup predefined times and is formatted as short time. The date and time are stored in the same table as date/time in separate fields. I attempted to use Dcount, and get syntax error missing operator. Below is one of a hundred that i have tried after scouring this forum and the net. I ended up converting the Appt_Time field to a text field in the table to eliminate one date field but still got no where. Any suggestions as to the syntax or perhaps a different approach would be greatly appreciated?
Code:Private Sub Appt_Time_BeforeUpdate(Cancel As Integer) 'Check table for duplicate If DCount("[Appt_Time]", "tblexams", "Appt_Time= & Appt_Time & And [Sch_Date] = #" & Sch_Date & "#") > 0 Then 'Message box warning of duplication 'MsgBox "Warning Appointment Time " _ & Appt_Time & " has already been assigned" _ & vbCr & vbCr & "Please select another Time", _ vbInformation, "Duplicate Information" 'Undo duplicate entry Me.Undo Cancel = True End If End Sub