J
Jody
I have never used "End If" before, but I think I need it in the following code:
---------------------------------------------------------------------------------------
Private Sub RunReport_Click()
On Error GoTo Err_RunReport_Click
Dim stDocName As String
DoCmd.OpenQuery "AppendConsumerTable"
DoCmd.SendObject acSendReport, "ReplacementReport", acFormatSNP,
"(e-mail address removed)", "(e-mail address removed)", "(e-mail address removed)",
"Replacement Parts Request", "Please review the attached document and take
the necessary action.", 0
DoCmd.OpenQuery "UpdatePartSentQuery"
DoCmd.OpenQuery "DeleteConsumerTable_qry"
DoCmd.OpenForm "Menu"
DoCmd.CLOSE acForm, "Confirmation"
Exit_RunReport_Click:
Exit Sub
Err_RunReport_Click:
MsgBox Err.Description
Resume Exit_RunReport_Click
End Sub
---------------------------------------------------------------------------------------
Yesterday, when the user clicked the button to execute this series of
events, the code failed which resulted in the following:
1: The data was not appended to the Customer Table
2: The report was rendered empty
3: The data WAS deleted from the temp table
4: The Menu form opened
5: The "Confirmation Form" did close
The desired result I am seeking is that if the first command fails, then
stop executing the code, and so on for each additional line. I am just
unsire of the syntax of the End If sttement.
Any help is appreciated.
---------------------------------------------------------------------------------------
Private Sub RunReport_Click()
On Error GoTo Err_RunReport_Click
Dim stDocName As String
DoCmd.OpenQuery "AppendConsumerTable"
DoCmd.SendObject acSendReport, "ReplacementReport", acFormatSNP,
"(e-mail address removed)", "(e-mail address removed)", "(e-mail address removed)",
"Replacement Parts Request", "Please review the attached document and take
the necessary action.", 0
DoCmd.OpenQuery "UpdatePartSentQuery"
DoCmd.OpenQuery "DeleteConsumerTable_qry"
DoCmd.OpenForm "Menu"
DoCmd.CLOSE acForm, "Confirmation"
Exit_RunReport_Click:
Exit Sub
Err_RunReport_Click:
MsgBox Err.Description
Resume Exit_RunReport_Click
End Sub
---------------------------------------------------------------------------------------
Yesterday, when the user clicked the button to execute this series of
events, the code failed which resulted in the following:
1: The data was not appended to the Customer Table
2: The report was rendered empty
3: The data WAS deleted from the temp table
4: The Menu form opened
5: The "Confirmation Form" did close
The desired result I am seeking is that if the first command fails, then
stop executing the code, and so on for each additional line. I am just
unsire of the syntax of the End If sttement.
Any help is appreciated.