General discussion

Locked

Access 2000 Date Validation

By Goliathkutaa ·
Ok, so this is my problem.

First, I am building a database in Access and using a form built in Access to add records. I am trying to do a form level validation with two date fields, a start and an end date. I don't want to force the validation at the table level as is causes a serious error, and I don't want the client to have access to debuging the problem. I just want to have a msgbox prompt the client that the end date cannot be set to before the start date, and that the start date cannot be greater than today (ie now()). Hopefully someone can help me out!

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Goliathkutaa In reply to Access 2000 Date Validati ...

Point value changed by question poster.

Collapse -

by Goliathkutaa In reply to Access 2000 Date Validati ...

Also, the endDate is linked to an activeX Calendar control, so on mouse down it pops up a calendar so the use can select a year.

Collapse -

by dryflies In reply to Access 2000 Date Validati ...

I am assuming you are using a calendar control to get your dates. I looked on my system and Calendar control 9.0 seems to be what is available. You will get the date from the "Value" property of the control. on your "OK button on the form containing the start and end date calendars add the DateDiff function to the on click event for the button such that the calendar form does not close and a warning is posted on the form about the start date being before the end date or the start date is before now().

retval = DateDiff("d",StartDate,EndDate)
if retval < 0 then warning and do not close form.
retval = DateDiff("d"StartDate, NOW)
if retval < 0 then warning and do not close form.
You can find the help for DateDiff in the visual basic help files that come up when you hit F1 in the Access VBA editor. piece O' Cake.

Collapse -

by Goliathkutaa In reply to

Perfect. thanks

Collapse -

by Goliathkutaa In reply to Access 2000 Date Validati ...

This question was closed by the author

Back to Software Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums