Validating times in Access

Oh, I forget so much these days.

I’m sure I knew how to do this, but the trouble with databases is that I only do this level of work once a year so I’m forever forgetting how to do stuff.

So, validating a time field in Access so that values can only be between certain times. Like the times a shop is open for.

Easy:

Between #09:00:00# and #17:00:00#

will do the job (in this case I want a time between 9am and 5pm). The #’s are the key thing that I forgot.

Image

I imagine this will work for Medium and Long Time fields as well. Probably anyway. You probably shouldn’t be using General Date field types so that’s not a problem.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s