View Full Version : Easy question for the pro's


KingRudeDog
05-17-2006, 01:59 PM
I am not yet proficient in programming VB, but even I know the basic's of this one. But I know asking the access gods will make my way smoother....

I want to have a command button visible based on a boolean (checkbox)...

So something like

If boolean1 = true
Then commandbutton73.visible = true

If boolean1 = false
Then command button73.visible = false

And, now that I think about this where would I insert this in the properties, or rather in the event section of properites.

As part of a database, the boolean would remain as the choice for that record every time I went back to it, always leaving the button either visible or invisible for that particular record.

Sergeant
05-17-2006, 03:39 PM
Make a Sub like this...
Private Sub UpdateButtonState()
If Me.Check5 Then
Me.Command7.Visible = True
Else
Me.Command7.Visible = False
End If
End SubAnd then add events to the Form_Current and CheckBox_AfterUpdate events...
Private Sub Form_Current()
UpdateButtonState
End SubPrivate Sub Check5_AfterUpdate()
UpdateButtonState
End Sub