Command Button Not Visible

B

Brian

Make a standalone procedure like this:

Private Sub HideShowCommand1()
If CheckBox then
Command1.Visible = True
Else
Command1.Visible = False
End If
End Sub

Now, call this when you change the CheckBox

Private Sub CheckBox_AfterUpdate()
HideShowCommand1
End Sub

Also place it inside your Form_Current event to ensure that the button is
shown/hidden based on the status of the checkbox as you navigate to each
record.
 
C

Connie

Hi all,
I am working in Access 2002 and would like a command button on a form to be
visible under certain conditions, and invisible under other conditions.

Eg: If [checkbox] = true, command button is visible, If [checkbox] = false,
command button is not visible.

I am not sure how to write this code nor on which event. Also, should it be
on the button's event, or on the form?

Any help appreciated.
Thanks
C
 
F

fredg

Hi all,
I am working in Access 2002 and would like a command button on a form to be
visible under certain conditions, and invisible under other conditions.

Eg: If [checkbox] = true, command button is visible, If [checkbox] = false,
command button is not visible.

I am not sure how to write this code nor on which event. Also, should it be
on the button's event, or on the form?

Any help appreciated.
Thanks
C

Code the CheckBox AfterUpdate event:

Me![CommandButtonName].Visible = Me![CheckBox]

Place the identical code in the Form's Current Event.
 
S

Steve Schapel

Connie,

For an alternative approach, simply put code like this on the checkbox's
After Update event, and the Current event of the form...

Me.YourButton.Visible = Me.CheckboxName

(of course, substitute the actual name of your command button and your
checkbox)

--
Steve Schapel, Microsoft Access MVP

Make a standalone procedure like this:

Private Sub HideShowCommand1()
If CheckBox then
Command1.Visible = True
Else
Command1.Visible = False
End If
End Sub

Now, call this when you change the CheckBox

Private Sub CheckBox_AfterUpdate()
HideShowCommand1
End Sub

Also place it inside your Form_Current event to ensure that the button is
shown/hidden based on the status of the checkbox as you navigate to each
record.


:

Hi all,
I am working in Access 2002 and would like a command button on a form to be
visible under certain conditions, and invisible under other conditions.

Eg: If [checkbox] = true, command button is visible, If [checkbox] = false,
command button is not visible.

I am not sure how to write this code nor on which event. Also, should it be
on the button's event, or on the form?

Any help appreciated.
Thanks
C
 
Top