Although I hate these ambiguities in Access, this gets *so* confusing that I
personally believe you are better off to just use the same name for the text
box and the bound field, and let Access sort it out.
If you have a text box named txtSurname, bound to a field named Surname,
then:
Me.txtSurname
is an object of type Textbox, whereas:
Me.Surname
is an object of type AccessField. There is very little documentation about
this type, and it has no properties except Value.
The object:
Me.Dynaset.Fields("Surname")
is different again. That reference tells you what type of data is expected,
if the field is required, etc. None of that information is available from
the AccessField object.
The AccessField therefore does not give you the field of the form's
RecordSource, and does not give you the control on the form, but is in some
kind of nether-world between the two. I suspect its existence is a
programming fudge, especially designed so you can get away with Me.Surname
when there is no control of that name on the form.
This fudge:
- Occassionally and unpredictably fails, preventing Me.Surname from
compiling, while Me!Surname (which is not checked by the compiler) still
works.
- Does not work on reports in the same way it does in forms, so you may have
to place a control on the report before you can refer to the field. (Again
this behavior is inconsistent.)
- Is probably the cause of intermittent serious crashes in Access 2002 and
2003, which you can work around by adding a text box on your subform for the
foreign key field(s) nominated in LinkChildFields. (That makes sense if the
Textbox reference is stable, while the AccessField reference fails
intermittently.)
If you do name your controls differently than their ControlSource, you also
open up the possibility of assigning a value to the AccessField instead of
the Textbox. The display is then inconsistent, and may not be updated
correctly until the record is saved.
So, IME, leaving the control names the same as their ControlSource is
simpler, quicker to develop, easier to maintain, and more stable.