Text field (with formula) displays "#Name?"

Zak14

Registered User.
Local time
Today, 03:12
Joined
Jun 27, 2014
Messages
166
I've got the following formula in the control source of a text field (txtAge). It automatically calculates age from txtDOB.
=DateDiff("yyyy",[txtDOB],Date())+Int(Format(Date(),"mmdd")<Format([txtDOB],"mmdd"))
It worked fine before, but now, every time I close the database and reopen it, the field doesn't work; it displays this: "#Name?".

When I create a copy of this field (txtAge) (and replace the orginal), it works again, but only until I close the database - and vice versa.
 
Try changing txtDOB to the name of the field instead.
 
Sorry, what do you mean?
 
txtDOB is the name of the textbox that holds your date of birth. What is the name of the field? Look in the Control Source property of txtDOB and replace it with that.
 
Thanks, it seems to work, but this code is really inconsistent. Sometimes, it'll work and other times it won't. Will this work all the time?
 

Users who are viewing this thread

Back
Top Bottom