G
Guest
Newbie here trying to use one command button on a form to first preview a
report and then email the report. Here is my code:
Private Sub Mail_Form_Click()
On Error GoTo Err_mail_form_Click
Dim stDocName As String
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Speaker Agree", acPreview, , "[ContractID] Like " &
Me![ContractID] & ""
stDocName = "SendToContracts"
DoCmd.RunMacro stDocName
DoCmd.Close acReport, "Speaker Agree"
DoCmd.Close acForm, Me.Name
DoCmd.Quit acQuitSaveAll
Exit_mail_form_Click:
Exit Sub
Err_mail_form_Click:
MsgBox Err.Description
Resume Exit_mail_form_Click
I am getting a message that says application cannot send email. Can anyone
help with what may be wrong with this code. Thanks in advance for the help.
report and then email the report. Here is my code:
Private Sub Mail_Form_Click()
On Error GoTo Err_mail_form_Click
Dim stDocName As String
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Speaker Agree", acPreview, , "[ContractID] Like " &
Me![ContractID] & ""
stDocName = "SendToContracts"
DoCmd.RunMacro stDocName
DoCmd.Close acReport, "Speaker Agree"
DoCmd.Close acForm, Me.Name
DoCmd.Quit acQuitSaveAll
Exit_mail_form_Click:
Exit Sub
Err_mail_form_Click:
MsgBox Err.Description
Resume Exit_mail_form_Click
I am getting a message that says application cannot send email. Can anyone
help with what may be wrong with this code. Thanks in advance for the help.