=date() returns #name

rangerruss

Registered User.
Local time
Yesterday, 19:48
Joined
Feb 12, 2009
Messages
11
The date() returns today's date on my design box. However, when I move the database to other machines, it returns #name. Using XP professional sp2 and sp3 as well as Office 2003 sp2 and sp3. All references are configured the same way.
Any Ideas where to look for the differences.:confused:
 
What name have you given the text box.

If you called it Date then change it to myDate.
 
What name have you given the text box.

If you called it Date then change it to myDate.

OK...but why does is work of some of the installs?
 
I assume my assumption was correct.

Date is a Reserved Word and should not be used as the name of a field or control.

Would need to see the other installs to be able to comment further.
 
I assume my assumption was correct.

Date is a Reserved Word and should not be used as the name of a field or control.

Would need to see the other installs to be able to comment further.

This is the control listing for all the installs:

control source = date
default value = =date()

all the units are using XP Pro and Access 2003 SP2 or sp3
on 9 of the 14 boxes it works as above....on the others the field in the form returns #name
 
The inconsistency just proves the value of NOT using reserved words. :)

Any chance that the 5 that don't work are on a different SP level to the 9 that do?

Brian
 
there will be a missing reference.

Open a code module and select tools, references, it may show those that are missing.

I think Date() is in VBA for Access, but I may be wrong.
 
The inconsistency just proves the value of NOT using reserved words. :)

Any chance that the 5 that don't work are on a different SP level to the 9 that do?

Brian

i have checked and recheck this....all are the same...
 
That's not Dennisk's point, he was just suggesting that that was the reference that is needed
Visual Basic for Applications

Brian

yes....i understood that.....this just seems to baffle me....plus it forces me to keep two sets of the applications....:confused:
 
I take it that you have not renamed the Control to MyDate or something other than Date ?

Brian
 
The control source should not be =Date. That shows that you have a field named "Date" and that needs to change - PERIOD. You cannot expect Access to do things consistently when you use reserved words as object names.

Second, to answer Dennisk's comment - yes =Date() is correct for the default value as it needs to know it is a function you are calling and it will add the brackets anyway if you try not to (unless you have a field named Date which then it will go all wonky).

So, if you created the form using the wizard then you likely also have a control named DATE which can further compound issues. Then, if you have Auto Name Correct enabled, even if you tried to rename it then it will go all wonky on you because you have 2 objects with reserved names which then Access tries to rename all of the references to that text box object but it can't because naming a function that exists can't happen so you just presented it with a paradox.

Moral of the story - DO NOT USE RESERVED WORDS AS OBJECT NAMES.

You may have to turn off Auto Name Correct, rename things, and then import it all into a new, blank database in order to actually fix it.
 
OK....I understand what both are saying....I will change the field names in the tables, queries and forms to comply...I will also look into the auto-name correct issue.
 
enlarge the field to be sure the date isn't getting cut off - I see #name when the field size is too small
 

Users who are viewing this thread

Back
Top Bottom