If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Disable cmd button - focus problem
I have a cmd button (filter button) that enables another button (print
preview button). I then disable this print preview button after it is clicked by first setting the focus to another control and then disabling the button. That works fine. Private Sub cmdSpecialPreview_Click() DoCmd.OpenReport "rptPrintPreview", acViewPreview, , strWhere cmdFilterOff.SetFocus cmdSpecialPreview.Enabled = False End Sub The problem is that if the user clicks the first button (which enables the 2nd button) and then clicks somewhere else. This keeps the second button enabled. I tried to disable the 2nd button in the lost focus event, but I get a message that I can not disable a button that has focus. I don't understand why I would get this message since I assumed it is only supposed to fire when the button loses focus. How can I disable this 2nd button if the next button the user clicks is not the 2nd button? |
#2
|
|||
|
|||
Disable cmd button - focus problem
Either in the same code that enables the 2nd button, disable all other
buttons so that they can only press the 2nd button. In the 2nd button code enable all the buttons again. Or In the click code of all the other buttons, diable the 2nd button. "Nick Del Vecchio" wrote: I have a cmd button (filter button) that enables another button (print preview button). I then disable this print preview button after it is clicked by first setting the focus to another control and then disabling the button. That works fine. Private Sub cmdSpecialPreview_Click() DoCmd.OpenReport "rptPrintPreview", acViewPreview, , strWhere cmdFilterOff.SetFocus cmdSpecialPreview.Enabled = False End Sub The problem is that if the user clicks the first button (which enables the 2nd button) and then clicks somewhere else. This keeps the second button enabled. I tried to disable the 2nd button in the lost focus event, but I get a message that I can not disable a button that has focus. I don't understand why I would get this message since I assumed it is only supposed to fire when the button loses focus. How can I disable this 2nd button if the next button the user clicks is not the 2nd button? . |
#3
|
|||
|
|||
Disable cmd button - focus problem
I was afraid this might be the only solution - but I had to ask.
I went with the 2nd suggestion. Took a little work but it is working fine now. Thanks |
Thread Tools | |
Display Modes | |
|
|