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!

Using 'me.' in a loop for field names 1

Status
Not open for further replies.

MDJ52

MIS
Mar 30, 2001
120
US
I am working on a form where there are 18 combo boxes and labels, numbered 1 through 18.
This is a brief piece of my code:
*************************************
If my1!position = 4 Then
Me.Combo4.Visible = True
Me.Combo4Label.Visible = True
Me.Combo4Label.Caption = my1!custparameter
Me.Combo4.RowSource = "Select [sel_parmv].[vvalue]
End If
****************************************
my1!position comes from a query assigned the my1 identifier.
Rather than have all of this for each of 18 combo boxes, I would like to be able to have a counter that will increase by 1 up to 18 and then when the 'if' statement executes, process the commands for that combo box and label.
I have tried 'me."combo" & counter.visible=true' but as expected it cannot identify the field.
I have also tried 'parm1="me.combo" & counter'. with this then do 'parm1.visible=true'
Is there a way to tell 'me.' a concatenated field name?

Thanks,
Mike
 
You need brackets:
Me("Combo" & Counter)
 
Remou
Thanks so much.
That did the trick and gave me much more flexability in my code

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top