The purpose of this form that I'm having trouble with is to create an appointment. The objective of what I am trying to do now is check the entered time against the actual time so that I can prevent appointments being created the occur in the past.
On my form I have 3 drop down boxes (1 for hours, 1 for minutes and 1 for AM/PM)
At the end of the form I am combining the 3 fields and adding a record to the appointment table
My code for that is:
AppointmentTIME = Me.hours & ":" & me.mins & " " & me.tod
then I'm taking that number and I have tried various procedures for example
IF LEFT(Me.HOURS, 2) < LEFT(TIME(), 2) then msgbox = "you cannot create appointments that occur in the past"
I have tried a bunch of different variations stemming from this concept and I cannot get it to work. I think I have my hours, minutes and time of day fields as text fields does that matter? Do I need to convert me.AppointmentTIME to a time field before I can check it against TIME()?
On my form I have 3 drop down boxes (1 for hours, 1 for minutes and 1 for AM/PM)
At the end of the form I am combining the 3 fields and adding a record to the appointment table
My code for that is:
AppointmentTIME = Me.hours & ":" & me.mins & " " & me.tod
then I'm taking that number and I have tried various procedures for example
IF LEFT(Me.HOURS, 2) < LEFT(TIME(), 2) then msgbox = "you cannot create appointments that occur in the past"
I have tried a bunch of different variations stemming from this concept and I cannot get it to work. I think I have my hours, minutes and time of day fields as text fields does that matter? Do I need to convert me.AppointmentTIME to a time field before I can check it against TIME()?