Calander Control & SLQ INSERT Statement

CharlesWhiteman

Registered User.
Local time
Today, 02:20
Joined
Feb 26, 2007
Messages
421
I have a form 'NewAppt' Which is unbound and contains various fields. I have a button with a macro/SQL Insert Statement which then inserts the data into my 'Appts' Table. However, I wanted to have a text field on the form to take a date selection but cant seem to do it? Any advise on how to achieve this?
 
On the textbox, just use a ShortDate as the format and in the BeforeUpdate event of that TextBox, verify it:

If Not(IsDate(YourDateTextbox)) Then
MsgBox "You must enter a valid date in this field to continue."
Cancel = True
End If

In the OnClick event of the button, call that textbox's BeforeUpdate event to verify there's a date there and it didn't get skipped.

You can also default the date to some date in the past that you won't schedule for (say 1/1/2000). Then, in the OnClick event of the button, you would check to see if the date in the textbox is less than today's date. If so, terminate the append SQL.
 

Users who are viewing this thread

Back
Top Bottom