Referencing tab control in code

P

Paco

I need to change the index value of a tab control using a function. I can
hard code it thus:

Forms!frmBuilding!tabBuilding.Value = 0

But I can't figure out how to pass the correct parameters to the function.

I've tried passing the name of the form as a string and referencing the
string, but that doesn't work. Any suggestions?

Thanks.
 
P

Paco

Nevermind. I just realized I can pass tabBuilding as a control and set its
value that way.
 
S

Stuart McCall

Paco said:
I need to change the index value of a tab control using a function. I can
hard code it thus:

Forms!frmBuilding!tabBuilding.Value = 0

But I can't figure out how to pass the correct parameters to the function.

I've tried passing the name of the form as a string and referencing the
string, but that doesn't work. Any suggestions?

Thanks.

Is this the kind of thing you mean?

Public Function SetTabValue(TabCtrl As Access.Control, Value As Long)
TabCtrl.Value = Value
End Function

Call it like this:

SetTabValue Me.MyTabControl, 0
 
Top