Please tell me why the following procedure would give me a type mismatch error after disabling all the command buttons on a form except the last one.
I have tried deleting the last button but then the error just backs up one button giving me the error on the "new" last button on the form.
Thanks!
I have tried deleting the last button but then the error just backs up one button giving me the error on the "new" last button on the form.
Thanks!
Code:
Private Sub cmdDisableButtons_Click()
On Error GoTo err_cmdDisableButtons_Click
Dim cmdButton As CommandButton
For Each cmdButton In Form
Text4.SetFocus 'avoids error when setting enable = false
'for command button which has focus.
'Debug line follows, just displays name of each button
MsgBox cmdButton.Name
cmdButton.Enabled = False
Next cmdButton
exit_cmdDisableButtons_Click:
Exit Sub
err_cmdDisableButtons_Click:
'GoTo exit_cmdDisableButtons_Click
MsgBox Err.Number & " " & Err.Description
End Sub