SendObject, seems to work, but not receiving emails

  • Thread starter Thread starter rgrantz
  • Start date Start date
R

rgrantz

I have the following code:

Private Sub Command30_Click()
On Error Resume Next

If DCount("*", "ReportName") > 0 Then
DoCmd.SendObject acSendReport, "ReportName", acFormatRTF,
"myemailaddress", , , "Warning", "OrderDelays", False

End If
End Sub

When I activate this procedure, I DO get the "Outlook is trying to send an
email on your behalf" message, and I click "Yes" to allow. However, it
appears that no email is actually sent. I've tried using several of my own
testing email addresses, and receive nothing. I was wondering if perhaps
the SMTP user account name/password, etc. needs to be logged in via this
code or something. Is that possible? Or perhaps the .pst file location
needs to be specified somewhere (because when I had the "preview email
first?" option enabled, I got an error that the outlook.pst file was not
found).

If there are specific things that need to be done regarding finding
outlook.pst, logging into email server, etc., can someone help me out with
that?

Thanks very much for reading
 
Change the False to True. This will display the email which is to be sent
allowing you to check the details. It is a good idea to set this value to
true during development.

I have not used the dCount("*",...) preferring to use a field such as an ID.

I am not sure that you can use a report name for the domain in dCount. I
thought it was tables, queries or sql.
You could try executing a sql statement (parallel to that of the report)
which returns the number of records the report would return.
HTH
Terry
 
Back
Top