Undefined function 'Date' in Expression

  • Thread starter Thread starter vcapy
  • Start date Start date
V

vcapy

I am tyring to calculate age in a query using [DOB], the
formula reads as follows (I'm using short date format)

Age: DateDiff("yyyy",[DateOfBirth],Date())+(Format
([DateOfBirth],"mmdd")>Forma-
t(Date(),"mmdd"))


It won't run, the message "Undefined function 'Date' in
Expression" appears everytime. Is the formula incorrect
or is this an ongoing problem. From what I understand
this is a common problem. Can anyoe tell me what I am
doing wrong or what needs to be done to correct the
problem. I need details I am a novice. Thanks in
advance.
 
Do you possibly have something else named Date in your database: a field in
a table, a control on a form, a function, etc.? Date is a reserved word, and
you should never use it to name your own objects.

If you can't find anything offending object, it's possible that your
references are messed up.
 
Darn: hate when that happens!

Meant to give you instructions for fixing reference problems:

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)



--
Doug Steele, Microsoft Access MVP



Douglas J. Steele said:
Do you possibly have something else named Date in your database: a field in
a table, a control on a form, a function, etc.? Date is a reserved word, and
you should never use it to name your own objects.

If you can't find anything offending object, it's possible that your
references are messed up.


--
Doug Steele, Microsoft Access MVP



vcapy said:
I am tyring to calculate age in a query using [DOB], the
formula reads as follows (I'm using short date format)

Age: DateDiff("yyyy",[DateOfBirth],Date())+(Format
([DateOfBirth],"mmdd")>Forma-
t(Date(),"mmdd"))


It won't run, the message "Undefined function 'Date' in
Expression" appears everytime. Is the formula incorrect
or is this an ongoing problem. From what I understand
this is a common problem. Can anyoe tell me what I am
doing wrong or what needs to be done to correct the
problem. I need details I am a novice. Thanks in
advance.
 
Back
Top