Validation Rule - Date Function Error

R

Rick

I am trying to create a validation rule for a date field which will
check, via a data entry form, to see if the date entered is between
12/31/94 and todays date.

In the table I have created a Validation Rule in the table:
#12/31/1994# And <=Date()

When I enter a new record in the form I get a Run-time error stating
Unknown function 'Date' in validation expression

I've also tried
Between #12/31/1994# and Date()
with the same results

Can anyone help me out with the proper validation function?

Rick
 
D

D Collins

Try:

Between #12/31/1994# And Date()
-----Original Message-----
I am trying to create a validation rule for a date field which will
check, via a data entry form, to see if the date entered is between
12/31/94 and todays date.

In the table I have created a Validation Rule in the table:

When I enter a new record in the form I get a Run-time error stating
Unknown function 'Date' in validation expression

I've also tried
Between #12/31/1994# and Date()
with the same results

Can anyone help me out with the proper validation function?

Rick
.
 
R

Rick

D Collins said:
Try:

Between #12/31/1994# And Date()

I tried changing the 'and' to 'And' as suggested but receive the same
error. I also found an article discussing this problem and followed
the suggestion to hit CTRL-G and go into debug. Then Tools and
References. Sure enough there is a missing reference:
Microsoft DAO 2.5/3.5 Compatibility Library
The article suggested simply to un-check the MISSING box and re-check
it. It did so but it didn't have any effect on recreating a path or
whatever.

Next I changed the Date() function to Now() and everything worked.

However I still would like to understand the problem better. The other
alternative I could think of would be to write an Event for the input
field on the form that would check to see if the date entered was
between 12/31/1994 and today and it would have to handle a message if
the date did not meet that criteria.

Could you help me with this Event code?
 
D

Douglas J. Steele

Try the following to ensure your references have, in fact, been fixed.

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




--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)
 
R

Rick

Douglas J. Steele said:
Try the following to ensure your references have, in fact, been fixed.

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

Doug,

I followed your instructions to the letter and it worked perfectly.
THANK YOU!!!!
For some unknown reason the library item in References marked
'MISSING'apparently was not needed. After un-checking it and clicking
OK to close the window, I compiled the database and everything went
smoothly. Anyway, I can now use the Date() function. Again thank you
so much.

Rick
 

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