Error on =Date() function

trstorer

Registered User.
Local time
Today, 21:21
Joined
May 23, 2000
Messages
30
I have a data entry form that I want the current date to be automatically added. When I add this function to that field it returns the following error:
----------
You may have used a DoEvents, LBound, UBound, Spc, or Tab function in an expression.

You may have used an SQL aggregate function, such as Count, in a design grid or in a calculated control or field.
----------
I did have a query with a Count which I deleted from the databased, but still get the error. I get the same error in any form that I create in this database, so it seems to be database-wide rather than an error within the form itself.
Any ideas ???

I have successfully done this in several other databases without a problem.

I appreciate any suggestions. Thank you.
 
If you are trying to insert today's date in VBA it's just "= Date" without quotes. Date() for SQL
 
On your table, you can set the field's default value to "=NOW()", then set the format to whatever date time format you prefer (long date, short date, etc...).
HTH,
Stephen
 
If you want to date stamp the record for the date of entry use Date() in the table properties, Now() will always show you today's date
 
DBL,

I think you're a little confused. Both Date() and Now() refer to today's date but Now() also includes the current time.

trstorer,

if you only want the date stored when a row is added, set the default for the field in the table to either Date() to store just the date or Now() if you want the date and time. If that doesn't resolve the problem, you may have a MISSING reference. To check this, open ANY code module and check Tools/References and look for the word MISSING. There are many posts here with solutions depending on what actually caused the missing reference.
 
Thanks Pat. I thought that Now() would update to show me the current date and time where Date() stayed static to the date of entry. You get used to doing things a certain way and don't look around for other possibilities....

[This message has been edited by DBL (edited 03-19-2002).]
 
Thank you to all who replied. I had tried NOW() and got the time, but didn't really want that, but also did find another post which made reference to "newer PCs" not handling DATE(). They recommended using =DateValue(now()) which (so far) has done the trick.

This is a great forum and has answered many of my questions - thanks for your help and ideas !
 
Huh. I use both Date() and Now() often, and I'm running Acc2k & Win2k. Just checked it.

Good luck,
David R
 

Users who are viewing this thread

Back
Top Bottom