Dates

  • Thread starter Thread starter Dale Brown
  • Start date Start date
D

Dale Brown

I have a text field in a table that I would like to query and do a check to
see if a date has been entered or not. The user can other information
besides a date so I do not want to change this to a date/time field. Is
there a way to do this check so that if it is a date I can do a date
function against it like datediff otherwise return the text.

Dale Brown
 
Dale

First, using a single field to hold more than one kind of data ("the user
can enter other information besides a date") is not good db design. You
want to keep "one field, one fact" in mind to make the most of the tools
Access provides.

Next, if you DON'T type it as date/time, you will have to evaluate whether
each of the following are actually dates:

Next Tuesday
3/1/2005
1/3/2005 (?d/m/y?)
Tuesday, April 20th
January 1st

Wouldn't it be easier to force/require a valid date?

Finally, there's a function (IsDate(), if I recall correctly) you can use in
the control's BeforeUpdate event to ensure that what was entered is actually
a date (but see my list of "dates" - I don't thing Access is quite as
liberal as you might be in interpreting what is/isn't a date).
 
Back
Top