how to hide a command button??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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
 
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
 
Back
Top