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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate Values to Specify Form Name 1

Status
Not open for further replies.

noelville

Programmer
Jan 20, 2009
14
CA
Hello, I want to save lines of code by specifying the form name as a concatenation of two values: a constant TAB + a number.

I have a main form and multiple subforms: e.g. Tab01, Tab02 ....
Is it possible to refer to the appropriate subform this way rather than hardcode Tab01 or Tab02 ... e.g.

instead of:
Me.Tab01.Form.Filter = "PageName"

define strIX as "01" or "02" ...

Me.["Tab" & "'" & strIX & "'"].Form.Filter = "PageName"
Thanks Alex
 
The Controls collection can accept a string as an index:

[TT]
Me.Controls("Tab01")
[/TT]

so you should be able to use your concatenated values
[TT]
controlName = "Tab" & strIX
Me.Controls(controlName).Form.Filter = "PageName"
[/TT]

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top