Default date only

  • Thread starter Thread starter Jake F
  • Start date Start date
J

Jake F

I'm working on a survey and need the default of the DateDone field to be the
date entered. I have Date() in there currently, but it includes the time
portion which I do not want or else I cannot use it as a key field properly.
Is there a different word than Date() I need to use, or else should i throw a
Left(...) or something in there?
 
That doesn't make sense (unless you're concerned that it's showing a time of
00:00:00), since the Date function returns only the date. without a time
portion (Now returns both)

The Date data type in Access is an 8 byte floating point number where the
integer portion represents the date as the number of days relative to 30
Dec, 1899, and the decimal portion represents the time as a fraction of a
day. That means that if you've got a date only, technically there is a time
of midnight associated with it.
 
Strange
Date() should return just the date
Now() will return the date and the time
Time() will return just the time.

If Date() is really returning the Date and Time you might try wrapping it in
the DateValue function

DateValue(Date()) should strip off the time.

In the VBA Immediate window try typing
?VBA.Date()
and hitting return. If that gives you just the Date then try
?Date()
and see if that returns just the date. If the second instance returns a date
and time, you probably have a user defined function Date that is returning the
Date and Time. You will have to track it down.

It it returns the date, then someplace in your application, you are doing
something to cause the problem.


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Back
Top