Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date validation

Status
Not open for further replies.

sades1

Programmer
Apr 15, 2002
25
US
hi,

i have another question......how do i do a validation on a date entered by the user?
the date field is in the form mm/dd/yy and i want to check if it is greater than the current date and if so display and error. and also i want to check if it
is older than a particular date...how do i do this??

thanks,
sades
 
In table design, enter the following in the validation rule field : > Date()
You can enter an error message in validation text field
 
I think you might want to change that validation to < DATE() if your error is raised by any entry GREATER than today's date....

The other validation should be handled in an AFTER UPDATE or EXIT event of the text box. Presumably, your entered data must be LESS than today, but GREATER than some other day????

There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
hehe........yeah, thats what i wanted......i want it to accept a date between some day in the past and todays date...
how do i type it in on the after update thing? something like say if its <Date (mm/dd/yy) then show an error message?
 
Sub Dateguy_afterUpdate()

if Dateguy < #01/01/1990# then
msgbox &quot;TOO OLD. Try again&quot;, vbOKOnly
CancelEvent
end if

end sub

Since you have a validation rule in the table design for < DATE() , we know it's ok on that side. Now we just need to check to make sure it's not LESS than your &quot;other&quot; date...

There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
hey,

tnx a lot.......

this site is proving to be very helpful!!!!!!

SaDeS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top