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

Concatenating a string variable with an object name

Status
Not open for further replies.

tomhughes

Vendor
Aug 8, 2001
233
US
I am trying to concatenate an object name with a string Variable. This text returns the proper value.
Code:
str = " '" & Forms!frmMain.TopicHeadA & "'"

I have tried numerous string arrangements, with no success, it would seem to me that this string arrangement should work.
Code:
strTabNo = "A"
str = '" & Forms!frmMain.TopicHead & strTabNo & "'"

but it gives me the following error

Run-time error '2465'
Application-defined or object-defined error

There has got to be a way of doing this. Does anyone know how???

 
In this instance, it is best to use the collections...

So referring to a specific tab on a form is done as:

Forms("frmMain")("TopicHeadA")

If you want to make part of it variable:

strTabNo = "A"
Forms("frmMain")("TopicHead" & strTabNo)

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top