MS Access Form: Checking for a valid date in an unbound text box

Given that there are number of valid date formats in MS Access, how can I check an unbound text box to see if the user has entered a valid date?

This isn’t exactly what you’re asking, I think, but it might solve the problem. Under the text box data properties, under input mask, you can get a wizard that allows you to force a certain format, e.g., 99/99/0000;0;_ (for a long date). In this format, they’ve got to use a four-digit year, but at least it won’t accept anything else. Will this solve your problem?

Daniel

Alternatively, there’s an IsDate function that you could add to the LostFocus event for that field. IsDate(datevalue) will return True if it’s a recognizable date and False if not. However, you would need to do some coding around that function to force them to redo the date as needed.

I’m not sure, I’ll play around with it and see how it behaves.

Thanks for the tip!

That may be exactly what I need!