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

Code to Name a ComboBox Object 1

Status
Not open for further replies.
Apr 9, 2002
102
US
I am trying to accomplish the following, but can not get the code to work:

I have a set of comboboxes on a form named as follows:

cboTestYN
cboJunkYN
cboProcessYN

I want to set up a function that will take a variable as part of the name of the combo box I want to use and set the control or combobox equal to that variable. Here is what I have tried so far:

Private Sub Tester(LayerName)
Dim ComboBoxer As ComboBox

Set ComboBoxer = "cbo" & LayerName & "YN"

End Sub

How can I change this code to make it work. After I set ComboBoxer, I would like to be able to set the visability and other things. This is on a much simpler scale that what I am trying, but hopefully I am getting my major point across.

If you have any suggestions, please let me know. Thanks.

Marrow
 
Dead easy:
Set ComboBoxer = me.controls("cbo" & LayerName & "YN")

hth

Ben ----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top