How do I disable a combo box on a form until a certain button is p

T

Timmy

I Have A Form That Has A Command Button And A Combo Box. I Want To Disable
The Combo Box Until The Command Button Is Pressed
 
F

fredg

I Have A Form That Has A Command Button And A Combo Box. I Want To Disable
The Combo Box Until The Command Button Is Pressed

Set the combo box Enabled property to No. (it's on the control's
property sheet's Data tab).

Code the Command button's Click event:
Me!ComboName.Enabled = True

The Combo control will then be enabled until you re-set it's Enabled
property to false (using code), or the next time you open the form.
 
M

missinglinq via AccessMonster.com

Make a command button and name it cmdEnableDisable
Select the button then Goto Properties -- Format and make Caption = "Enable
Combo Box"
Select your Combo Box then Goto Properties -- Data and set Enabled to NO

Here's two code variations:

'This will simply enable the combo box with no way to disable it

Private Sub cmdEnableDisable_Click()
YourComboBox.Enabled = True
End Sub

'This will use the single command button to
'Enable and Disable the combo box

Private Sub cmdEnableDisable_Click()
If YourComboBox.Enabled = False Then
YourComboBox.Enabled = True
cmdEnableDisable.Caption = "Disable Combo Box"
Else
YourComboBox.Enabled = False
cmdEnableDisable.Caption = "Enable Combo Box"
End If
End Sub

'If you use the second code example you'll need
'this to reset the state when moving from record
'to record (if user forgets to click the button again)

Private Sub Form_Current()
YourComboBox.Enabled = False
cmdEnableDisable.Caption = "Enable Combo Box"
End Sub
 
T

Timmy

Thanks a lot. That worked great

fredg said:
Set the combo box Enabled property to No. (it's on the control's
property sheet's Data tab).

Code the Command button's Click event:
Me!ComboName.Enabled = True

The Combo control will then be enabled until you re-set it's Enabled
property to false (using code), or the next time you open the form.
 
Top