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
..
 
Back
Top