I have had success making email buttons. But not this one. I have 2 buttons on the Invoice form. One to print preview or go to the printer. The newer one is for an email.
The email address gets into the MS Outlook "TO" just fine. The PDF gets into the attachment just fine.
However, the PDF content has only the report formatting etc except there is NO DATA in the report. See the email button ON Click below:
(PS - where you see "Name" txtOrderID, I original used the Control Source OrderID. But i got the same problem either way. The report button did not seem to care either if i used txtOrderID or OrderID. i wonder which is best: the name or the control name?)
In the query Qry8700Invoice for the rpt8700Quote, I have a criteria in the OrderID field of: [Forms]![frm8700OrdersMain]![txtOrderID]
Just in case you needed to know. Again, the report button works fine. It gets previews the proper invoice. But the Mail Button will only show an invoice format with no data.
I don't get it.
Thanks, Cimoli and Glen
'------ here is the email button ON CLICK ------------
Private Sub cmdPrintEmail_Click()
On Error GoTo Err_cmdPrintEmail_Click
Dim strDocName As String
Dim strWhere As String
strWhere = "OrderID = " & Me.txtOrderID
strDocName = "rpt8700Quote"
DoCmd.SendObject acReport, strDocName, acFormatPDF, Me!cboEmail22
Exit_cmdPrintEmail_Click:
Exit Sub
Err_cmdPrintEmail_Click:
' If action was cancelled by the user, don't display an error message.
Const conErrDoCmdCancelled = 2501
If (Err = conErrDoCmdCancelled) Then
Resume Exit_cmdPrintEmail_Click
Else
MsgBox Err.Description
Resume Exit_cmdPrintEmail_Click
End If
End Sub
The email address gets into the MS Outlook "TO" just fine. The PDF gets into the attachment just fine.
However, the PDF content has only the report formatting etc except there is NO DATA in the report. See the email button ON Click below:
(PS - where you see "Name" txtOrderID, I original used the Control Source OrderID. But i got the same problem either way. The report button did not seem to care either if i used txtOrderID or OrderID. i wonder which is best: the name or the control name?)
In the query Qry8700Invoice for the rpt8700Quote, I have a criteria in the OrderID field of: [Forms]![frm8700OrdersMain]![txtOrderID]
Just in case you needed to know. Again, the report button works fine. It gets previews the proper invoice. But the Mail Button will only show an invoice format with no data.
I don't get it.
Thanks, Cimoli and Glen
'------ here is the email button ON CLICK ------------
Private Sub cmdPrintEmail_Click()
On Error GoTo Err_cmdPrintEmail_Click
Dim strDocName As String
Dim strWhere As String
strWhere = "OrderID = " & Me.txtOrderID
strDocName = "rpt8700Quote"
DoCmd.SendObject acReport, strDocName, acFormatPDF, Me!cboEmail22
Exit_cmdPrintEmail_Click:
Exit Sub
Err_cmdPrintEmail_Click:
' If action was cancelled by the user, don't display an error message.
Const conErrDoCmdCancelled = 2501
If (Err = conErrDoCmdCancelled) Then
Resume Exit_cmdPrintEmail_Click
Else
MsgBox Err.Description
Resume Exit_cmdPrintEmail_Click
End If
End Sub