How to specify a fully qualified field name?

D

David Carpenter

Using macros, how do I specify a fully qualified name of a text field within
a form on one page of a tab control?

For example, on a normal form it would be:
Forms![FormName]![FieldName]
 
T

Tom Wickerath

Hi David,

Try adding an equals sign. I just created a test macro in the Northwind
sample database, as follows:

Action MsgBox

In lower window:
Message =[Forms]![Customers]![CompanyName]

I saved the macro, and opened the Customers form to an existing record. When
I run the macro, it displays a message box with the expected CompanyName
displayed.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
J

John W. Vinson

Using macros, how do I specify a fully qualified name of a text field within
a form on one page of a tab control?

For example, on a normal form it would be:
Forms![FormName]![FieldName]

Forms don't have Fields (Tables have Fields); Forms have Controls.

The Tab Page is irrelevant with respect to referencing the control. If
the textbox is on a Subform, you need to use the Name property of the
main form and of the Subform control; the Subform control is the "box"
containing the subform, and it may or may not have the same name as
the form within it. The syntax is

[Forms]![Formname]![Subformcontrol].Form![textboxname]

The brackets are usually optional unless the form or control names
contain blanks or other special characters, but it never hurts to put
them in.

John W. Vinson [MVP]
 

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