Hi,
I would like to know how the best way to disable a button every time its focus is NOT in the detail and enable when a line in
a grid in the detail is selected (clicked). The button is located in the master.
I've done that but did't work:
Private Sub cmd_LostFocus()
Me.cmd.Enabled = False
End Sub
It gave me the error:
Run-time error '2164'
You can't disable a control while it has the focus
I also tried to play with the Subform/Subreport events On Enter and On Exit as follow:
Private Sub sub_Enter()
Me.cmd.Enabled = True
End Sub
Private Sub sub_Exit()
Me.cmd.Enabled = False
End Sub
It worked to enable and disable. However, when I am in the grid in the Subform and try to click in the bottom that is in the
FormHeader, it raises the event Exit and, therefore, disable the botton. Any other solution?
Is there a way for me to say in the sub_Exit like this?
Private Sub sub_Exit()
If NOT Me.cmd.Click Then
Me.cmd.Enabled = False
End if
End Sub
Thank you in advance.
Regards.