What data type would this be?

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

This should be simple?....

I want to take the text selected in a combo box, after update, and use the
text to make another field visible. Like this:

Dim ctlGrpLvl1 As ???
ctlGrpLvl1 = [Forms]![frmReportsMenu]![cboGrpLvl1]
ctlGrpLvl1.Visible = True

The value of that combo box matches exactly to the name of a control. If I
do STRING or VARIANT, it puts quotes around it, and that's not it.
I thought it would be CONTROL, but no dice.
You can see that I'm pretty much clueless. Can anyone point me in the right
direction here?

Thanks!
 
Tim said:
This should be simple?....

I want to take the text selected in a combo box, after update, and use the
text to make another field visible. Like this:

Dim ctlGrpLvl1 As ???
ctlGrpLvl1 = [Forms]![frmReportsMenu]![cboGrpLvl1]
ctlGrpLvl1.Visible = True

The value of that combo box matches exactly to the name of a control. If I
do STRING or VARIANT, it puts quotes around it, and that's not it.
[...]

Use the Controls Collection of the Form:

Me.Controls(me!cboGrpLvl1).Visible = True

HTH
Matthias Kläy
 
Tim said:
I want to take the text selected in a combo box, after update, and use the
text to make another field visible. Like this:

Dim ctlGrpLvl1 As ???
ctlGrpLvl1 = [Forms]![frmReportsMenu]![cboGrpLvl1]
ctlGrpLvl1.Visible = True

The value of that combo box matches exactly to the name of a control. If I
do STRING or VARIANT, it puts quotes around it, and that's not it.
I thought it would be CONTROL, but no dice.


You're making it much tougher than necessary. Try this:

Me(cboGrpLvl1).Visible = True
 
You're making it much tougher than necessary.
Usually the case unfortunately :)

Thank you for the help!

Marshall Barton said:
Tim said:
I want to take the text selected in a combo box, after update, and use the
text to make another field visible. Like this:

Dim ctlGrpLvl1 As ???
ctlGrpLvl1 = [Forms]![frmReportsMenu]![cboGrpLvl1]
ctlGrpLvl1.Visible = True

The value of that combo box matches exactly to the name of a control. If
I
do STRING or VARIANT, it puts quotes around it, and that's not it.
I thought it would be CONTROL, but no dice.


You're making it much tougher than necessary. Try this:

Me(cboGrpLvl1).Visible = True
 
Back
Top