Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indirect Addressing 1

Status
Not open for further replies.

DMHCCI

Vendor
May 9, 2003
22
US
Dim FieldName as String

FieldName = "[forms]![client]![name]"

&Fieldname = !last_name

In the example above I want to be able to get the contents of [forms]![client]![name] updated by the contents of !last_name. The compiler rejects this syntax. Perhaps there is a different character or index register or subscript method instead of the & character which is used to concatenate as well. Is there a way to use indirect addressing? I want to use a field list stored in a table to dynamically select the field that gets updated. Another words reference an address within an address.
 
Try:

[tt]dim strControl as string
dim strForm as string

strControl = "name"
strForm = "client"

forms(strForm).controls(strControl).value = !last_name[/tt]

Roy-Vidar
 
I see what you are doing.

What I need is a way to do something even more generic.

What would be the syntax for a table?

table(strtable).controls(strcontrol).value

Any other forms of this?

 
Open the table, and address it's fields collection.

[tt]dim strFieldName as string
dim strForm as string
strForm = "client"
strFieldName = "FullName"
forms(strForm).controls("txt" & strFieldName).value = _
rs.fields(strFieldName).value[/tt]

- using my preferred naming convention of prefixing control names with their type (txt - text control)

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top