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

Need help with this Access code

Status
Not open for further replies.

Tommy408

Programmer
Apr 30, 2006
53
US
I'm writing a universal function for A LOT of similar buttons on different tab. The buttons is depended on the tab.

So instead of for example:

If Me!TabControlName.Value = 0 Then
If Me!ToggleButton1.Value = True Then
Do Something
End If
If Me!ToggleButton2.Value = True Then
Do Something
End If

ElseIf Me!TabControlName.Value = 0 Then
If Me!ToggleButton1.Value = True Then
Do Something
End If
If Me!ToggleButton2.Value = True Then
Do Something
End If
EndIf

Is there a way I can do something like this ( example):

If Me!ToggleButton1(Me!TabControlName.Value).Value Then
Do Something
EndIf

What I mean by this :
Me!ToggleButton1(Me!TabControlName.Value).Value
is the Value of the Toggle Button 1 on a Specific Tab Control. Like an array...
 
I'd say you can name the togle buttons in a certain way.
For example Tgl_1_2 is the second button on first tab.
Then when you reffer to it you use
Me.Controls("Tgl_" & Me!TabControlName & "_" & BtnNo)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top