Date() in query criteria not working

B

Brenda

I get an error undefined function 'date' in expression
error anytime I try to use the query designer to pick up
the current date. I am very new to Access but love it.
It's the last piece before I roll out the new
table/querys/reports on the office. I went to the website
and have found the cause to be "user-defind function is
located in the report module" and the resolution
to "transfer the user-defined function form the report
module to a global module". Then Microsoft starts talking
about editing the Northwind.mdb sample database which I
can't even get open anymore since downloading last week
(it keeps asking me if I want to install over & over).
Even so, I don't know why I'm modifying a sample database
as opposed to my database. And to boot, I don't
understand what I'm supposed to type!

Can someone please help me?
 
R

Rick Brandt

T-Money said:
Brenda,

To return the current date, use "=Now()"

Without the quotes, of course...

This is incorrect advice given the stated problem.

It is common to have broken references in an Access application. This causes many of
the built-in functions to mess up (Date() being one of them). While it is true that
when this is occurring that the Now() function will still work, it is not sufficient
to simply use Now() in place of Date(). The broken references must be addressed.
Not only is Now() the wrong tool in many cases, but there will be other problems in
the application until the references issue is taken care of. So the proper answer is
to correct the references and then Date() will perform as expected.

To the OP:

Open any code module and got to Tools - References.

Of those that are "Checked" see if any have the word "Missing" after them. If so,
this is your problem. In some cases these references are not actually required and
you can solve the problem by just un-checking them. If your application needs that
reference to function, then the reference must be fixed rather than removed.

To see if you need the reference, do a Compile All on the file and see if it will
compile successfully after you have removed the reference. If it does, then you are
good to go. If it doesn't, sometimes going back in and re-checking the reference
will still solve the problem. If not, then it means that the library in question is
not properly registered on your system. You will either need to correct that or
modify your application so that the missing library is no longer required.
 

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

Top