Access Textbox Trouble
Imagine a form that captures first and last name from a table. At first you
drag the two fields onto the form separately. You may notice that the
textboxes created are named the same as the fields they capture: FirstName
and LastName.
The name of the textbox is shown in the object box in Access.
However, you decide that since this form isn’t for data entry, the two
fields would look better as a concatenated field =[FirstName] & ‘ ‘ & [LastName]
so you change the data in the first textbox and delete the second one.
But what happens to the first textbox? It starts giving you an error.
"This control has a reference to itself." That’s because the name of the field and the name of the textbox are the
still same but now the data in the textbox is a formula to be evaluated, not
just a simple data field.
You have a circular reference. Access searches your tables, your form and
your VBA code to find the name of the value you reference in the textbox
formula, so when your textbox is evaluated, it looks like it’s referring to itself.
Look at the graphic above... it IS confusing, isn't it?
You have to change the name of the textbox so that it doesn’t have the
same name as a field. Go to the Properties window for the textbox in
question and change FirstName to txtFullName as shown.
Watch out! In Office 2003, Access ‘helps’ you out by changing any reference
to your textbox to the new name and can put you right back where you started
again. Save and close your form and double-check that Access hasn't changed
your formula to =[txtFullName] & ' ' & [LastName].
The best practice is to change the names of all of your textboxes when
you create them so that they have distinct names from the fields they are
bound to.