Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SendObject not working 1

Status
Not open for further replies.

kaiana

Programmer
Joined
Sep 6, 2002
Messages
85
Location
AU
Hi,

I have read all the threads on sendobject and can't find a problem. I am wanting to email a snapshot of a report and I am using this code in the onclick event of the cmd button:

DoCmd.SendObject acSendReport, "Parents", "Snapshot Format", Email, , , "Report", "Report"

It is going through the code without error but no email. Is there something I am missing.

Do I need references? I have tried it with and without Outlook references.


 
Try specifying the email address you want to send to
instead of just typing the word "Email" in the string, i.e.
"you@email.com" or something.

This parameter is a string expression that lists one or
many recipients whose names you want to put on the To
line in the mail message.

If the recipient names aren't recognized by the mail
application, the message isn't sent and an error occurs.

Also, if you leave the argument blank, Access will
prompt you for the recipients.

Regards...
 
chickey,

I knew I just should have gone to bed. After your suggestions I played with the code and took out the email altoghether and it finally came up with an error that the report was misspelled, no "s". I thought that I had tried every variable last night. Obviously not. Thanks for your time.

Regards
 
Ok I have all that working beautifully now. So I wrote some code for the body of the email and it is obviously causing problems. It will send the first email but not send any more even after closing all forms and reopening. I have to quit right out of my db and get back in and it will then send the first one again and so on. I then have to totally rebuild my code before it seems to reset it. Through doing this several times I have discovered that it is my body text that is causing the problem. Can anyone suggest a reason for this. I have even transfered all forms, tables, queries etc to a new db incase of corruption but still did not fix it. I am using Access 2000.

Here is my code:

Private Sub SendEmail_Click()

Dim esubject As String
Dim ebody As String

esubject = "Happy Birthday"
ebody = "Congratulations " & [FirstName] & Chr(13) & Chr(13) & "Should you have difficulty downloading" _
& " your voucher please contact this office." & Chr(13) & Chr(13) & "Regards"

DoCmd.SendObject acSendReport, "BirthdayVoucher", acFormatSNP, Email, , , esubject, ebody, False


End Sub
 
I found a support note on the Microsoft website. This is apparently caused by too many characters in the body. There is alternative code on the website if anyone else has had this problem.

Regards
 
It's an Access 2000 bug that does exactly what you say...
If you happen to use Outlook, try Automation.

If not, make sure your separator for email addresses is semicolon (;), not comma (;) and that the 'List separator' in Regional Settings is semicolon as well.
It worked for me, but I can't be sure it's a global fix.

HTH


[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top