I am trying to create some code that will bring up a message box. When a user types in a response I want them to click cmdSaveResponse and then click cmdNextQuestion. If the user doesn't click cmdSaveResponse, once they click cmdNextQuestion I want a message box to appear that tells them that they must first save their response.
Private Sub cmdNextQuestion_Click()
On Error GoTo Err_cmdNextQuestion_Click
If (Me!sfrmSurveyInfo.Form!cmdSaveResponse.OnClick = True) Then
DoCmd.GoToRecord , , acNext
ElseIf (Me!sfrmSurveyInfo.Form!cmdSaveResponse.OnClick = False) Then
MsgBox ("You must save your response before you proceed to the next question.")
End If
Exit_cmdNextQuestion_Click:
Exit Sub
Err_cmdNextQuestion_Click:
MsgBox Err.Description
Resume Exit_cmdNextQuestion_Click
End Sub
I know that my code isn't correct so any tips will be greatly appreciated.
Thanks!
Private Sub cmdNextQuestion_Click()
On Error GoTo Err_cmdNextQuestion_Click
If (Me!sfrmSurveyInfo.Form!cmdSaveResponse.OnClick = True) Then
DoCmd.GoToRecord , , acNext
ElseIf (Me!sfrmSurveyInfo.Form!cmdSaveResponse.OnClick = False) Then
MsgBox ("You must save your response before you proceed to the next question.")
End If
Exit_cmdNextQuestion_Click:
Exit Sub
Err_cmdNextQuestion_Click:
MsgBox Err.Description
Resume Exit_cmdNextQuestion_Click
End Sub
I know that my code isn't correct so any tips will be greatly appreciated.
Thanks!