I am trying to disable the next button on a form called frmCompany
In the forms Current event procedure I am putting the following code.
Private Sub Form_Current()
' If this form is on a new record, The Next button button should be disabled
'to do this to shift the focus first. If there is
' a value in CompnayID we must enable the button.
If Me.NewRecord = True Then
cmdPrevious.SetFocus
cmdNext.Enabled = False
Else
cmdNext.Enabled = True
End If
End Sub
But instead of the Next command button being disabled and shown as greyed the button is as normal and if I click it I get the following error displayed with the
Private Sub cmdNext_Click()
On Error GoTo cmdNext_Click_Err
DoCmd.GoToRecord , "", acNext
cmdNext_Click_Exit:
Exit Sub
cmdNext_Click_Err:
MsgBox Error$
Resume cmdNext_Click_Exit
End Sub
Where is the mistake in my code, the grey button should be greyed out and this is not the case.
Am I missing something really obvious
In the forms Current event procedure I am putting the following code.
Private Sub Form_Current()
' If this form is on a new record, The Next button button should be disabled
'to do this to shift the focus first. If there is
' a value in CompnayID we must enable the button.
If Me.NewRecord = True Then
cmdPrevious.SetFocus
cmdNext.Enabled = False
Else
cmdNext.Enabled = True
End If
End Sub
But instead of the Next command button being disabled and shown as greyed the button is as normal and if I click it I get the following error displayed with the
Private Sub cmdNext_Click()
On Error GoTo cmdNext_Click_Err
DoCmd.GoToRecord , "", acNext
cmdNext_Click_Exit:
Exit Sub
cmdNext_Click_Err:
MsgBox Error$
Resume cmdNext_Click_Exit
End Sub
Where is the mistake in my code, the grey button should be greyed out and this is not the case.
Am I missing something really obvious