Date() function will not work

D

dr ken

I am trying to run a query in access 97.
I get an error message when trying to use Date().
I am trying to use it to return today's date.
I get the following error messaage:
"The function isn't available in the query expression"

Any suggestions?
 
D

Douglas J. Steele

It's possible that your references are messed up.

This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

For far more than you could ever want to know about this problem, check out
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
 
B

Bruce Pick

dr ken said:
I am trying to run a query in access 97.
I get an error message when trying to use Date().
I am trying to use it to return today's date.
I get the following error messaage:
"The function isn't available in the query expression"

Any suggestions?
 
B

Bruce Pick

Ken,

Try Now() instead of Date().

Now() is current in Access 97 and also in Access 2000 and is better
supported. It includes date and time together. You will likely need to
format the result later to display meaningful output, as it will record date
+ time down to a second or a fraction of a second.

Bruce Pick
 
D

Douglas J. Steele

Sorry, but I don't agree that's a good solution.

First of all, it only addresses the symptom, not the cause. Secondly, adding
time when you don't need it can make your queries more complicated.

There are two common reasons for problems with the Date function.

The first is that you've inadvertently created some other object in your
database with the name Date. This could be a function, a module, a control
on a form or report, a field in a table, a variable name and so on. Bottom
lines is never use a system reserved word for any object that you create.

The other reason is that the application References have gotten messed up.

This can be caused by differences in either the location or file version of
certain files between the machine where the application was developed, and
where it's being run (or the file missing completely from the target
machine). Such differences are common when new software is installed.

On the machine(s) where it's not working, open any code module (or open the
Debug Window, using Ctrl-G, provided you haven't selected the "keep debug
window on top" option). Select Tools | References from the menu bar. Examine
all of the selected references.

If any of the selected references have "MISSING:" in front of them, unselect
them, and back out of the dialog. If you really need the reference(s) you
just unselected (you can tell by doing a Compile All Modules), go back in
and reselect them.

If none have "MISSING:", select an additional reference at random, back out
of the dialog, then go back in and unselect the reference you just added. If
that doesn't solve the problem, try to unselect as many of the selected
references as you can (Access may not let you unselect them all), back out
of the dialog, then go back in and reselect the references you just
unselected. (NOTE: write down what the references are before you delete
them, because they'll be in a different order when you go back in)

For far more than you could ever want to know about this problem, check out
http://members.rogers.com/douglas.j.steele/AccessReferenceErrors.html
 

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