MS Access date/time check

  • Thread starter Thread starter prog
  • Start date Start date
P

prog

Hi,

I'm working in design view of Access..specifically try to validate a field,
to check to see if it is in a specific date format. So, my example is below:

IIF([column1] like MM/DD/YYYY HH24:MM),"its a valid date", "not valid date")

So, I need a way to check for the given date format above where it is
MM/DDYYYY with the time include.
 
There is no need to check to see if it is in a specific date format. Use a
DateTime datatype field and Access will valid the date entry. The table does
not store format. Then in your display (form or report) set the format as
you wish.
 
Is the field a DateTime field or is it a text field?

IsDate([TheField]) will return True if the date string or datetime can be
properly interpreted as a date.

If the time component is anything else then midnight you could use
IIF(IsDate([TheField]), TimeValue([TheField]) <> #00:00:00#,False)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Date Function in query 3
Formatting date gives bad results in query 2
Convert Date 3
Date Calculation 1
Date Calculation 1
Peculiar date problem 1
Changing date format 2
Date format in query export. 4

Back
Top