how to hide a command button??

S

Sam Kuo

I'd like to have a command button (cbHide) that hides the command button
itself (and some textboxes) , I tried the line

Private Sub cbHide_Click()
cbHide.Visible = False
End Sub

but it doesn't work because Access can't hide a control that has the focus.
So what would the correct way of doing this? Thanks
 
G

GasMan

Give focus to a control you are not hiding?

I'd like to have a command button (cbHide) that hides the command button
itself (and some textboxes) , I tried the line

Private Sub cbHide_Click()
cbHide.Visible = False
End Sub

but it doesn't work because Access can't hide a control that has the focus.
So what would the correct way of doing this? Thanks

Please remove obvious from email address if emailing.
 
F

fredg

I'd like to have a command button (cbHide) that hides the command button
itself (and some textboxes) , I tried the line

Private Sub cbHide_Click()
cbHide.Visible = False
End Sub

but it doesn't work because Access can't hide a control that has the focus.
So what would the correct way of doing this? Thanks

Private Sub cbHide_Click()
Me![SomeOtherControl].SetFocus
cbHide.Visible = False
End Sub
 
S

Sam Kuo

Thanks Fred and GasMan.
Setting focus to a control I'm not hiding works.

Regards,
Sam

fredg said:
I'd like to have a command button (cbHide) that hides the command button
itself (and some textboxes) , I tried the line

Private Sub cbHide_Click()
cbHide.Visible = False
End Sub

but it doesn't work because Access can't hide a control that has the focus.
So what would the correct way of doing this? Thanks

Private Sub cbHide_Click()
Me![SomeOtherControl].SetFocus
cbHide.Visible = False
End Sub
 
Top