J
Jake F
I'm working on a survey database and when the user gets to the last question
i want to ask if they would like to review their answers or save and submit
the survey. I'd like to do it through a msgbox being that i haven't created
one that is more complicated than simple message display and an okay button.
Using the VBA help for msgbox i found the following code and adapted it to my
procedure. I cannot figure out how to change the text for the buttons and
also it is going to the wrong part in the procedure after update the combo so
I'm not sure how to specify the response is for the msgbox not the combo
response. Thanks. Also I'm fairly sure I don't need that many if/then
statements, but was trying to overdue to fix the If Response error.
Private Sub Combo14_AfterUpdate()
On Error GoTo Err_Combo14_AfterUpdate
Dim Msg, Style, Title, Ctxt, Response, MyString
Msg = "Do you want to review your answers or save and submit?" ' Define
message.
Style = vbYesNo + vbDefaultButton1 ' Define buttons.
Title = "Safety Survey" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Rspns = "Yes" Or Rspns = "No" And QstnNbr < 26 Then
DoCmd.GoToRecord , , acNext
QstnText.SetFocus
End If
If Rspns = "Unanswered" And QstnNbr < 26 Then
MsgBox "All questions must be answered.", vbOKOnly, "Safety Survey"
End If
If Rspns = "Yes" And QstnNbr = 26 Then
DoCmd.OpenForm frmNotes
If QstnNbr = 26 And Rspns = "No" Then
MsgBox Msg, Style, Title, , Ctxt
End If
If Response = vbYes Then ' User chose Yes.
MyString = "Review Answers" ' Perform some action.
DoCmd.GoToRecord , QstnNbr, acFirst
Else ' User chose No.
MyString = "Save and Submit" ' Perform some action.
DoCmd.Save acReport, "Rpt"
DoCmd.Close
Forms!fmnumain.Visible = True
End If
Exit_Combo14_AfterUpdate:
Exit Sub
Err_Combo14_AfterUpdate:
MsgBox Error$
Resume Exit_Combo14_AfterUpdate
End Sub
i want to ask if they would like to review their answers or save and submit
the survey. I'd like to do it through a msgbox being that i haven't created
one that is more complicated than simple message display and an okay button.
Using the VBA help for msgbox i found the following code and adapted it to my
procedure. I cannot figure out how to change the text for the buttons and
also it is going to the wrong part in the procedure after update the combo so
I'm not sure how to specify the response is for the msgbox not the combo
response. Thanks. Also I'm fairly sure I don't need that many if/then
statements, but was trying to overdue to fix the If Response error.
Private Sub Combo14_AfterUpdate()
On Error GoTo Err_Combo14_AfterUpdate
Dim Msg, Style, Title, Ctxt, Response, MyString
Msg = "Do you want to review your answers or save and submit?" ' Define
message.
Style = vbYesNo + vbDefaultButton1 ' Define buttons.
Title = "Safety Survey" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Rspns = "Yes" Or Rspns = "No" And QstnNbr < 26 Then
DoCmd.GoToRecord , , acNext
QstnText.SetFocus
End If
If Rspns = "Unanswered" And QstnNbr < 26 Then
MsgBox "All questions must be answered.", vbOKOnly, "Safety Survey"
End If
If Rspns = "Yes" And QstnNbr = 26 Then
DoCmd.OpenForm frmNotes
If QstnNbr = 26 And Rspns = "No" Then
MsgBox Msg, Style, Title, , Ctxt
End If
If Response = vbYes Then ' User chose Yes.
MyString = "Review Answers" ' Perform some action.
DoCmd.GoToRecord , QstnNbr, acFirst
Else ' User chose No.
MyString = "Save and Submit" ' Perform some action.
DoCmd.Save acReport, "Rpt"
DoCmd.Close
Forms!fmnumain.Visible = True
End If
Exit_Combo14_AfterUpdate:
Exit Sub
Err_Combo14_AfterUpdate:
MsgBox Error$
Resume Exit_Combo14_AfterUpdate
End Sub