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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this code for generating email?

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
I am using the following code to generate a spreadsheet version of the report and send it by email in Access 97. It works fine but when tried to invoke this module in XP 2002 envirironment on a converted copy of the database, it does nothing. Surprisingly, this code works fine for snapshot format in XP.

Any insights?


oCmd.SendObject acSendReport, "rptProjects", acFormatXLS, _
"email address", _
, , "WOW Project Design Progress", _
vbCrLf & "Dear Rod" & vbCrLf & vbCrLf & "Attached is the quarterly Project Progress report for your info." & _
vbCrLf _
& vbCrLf & "Cheers" & vbCrLf _
& vbCrLf & &quot;<Sender>&quot;, True

Cheers

AK

Note: Using Access 97 - still.
 
Try modifying it with this one.
DoCmd.OpenReport &quot;rptProjects&quot;, acViewPreview, , &quot;[Circuit ID]= '&quot; & strVal & &quot;'&quot;
DoCmd.SendObject acSendReport, , acFormatXLS, &quot;Email address&quot;, , , &quot;Dear Rod&quot;, &quot;Attached is the quarterly Project Progress report for your info&quot;
DoCmd.Close acReport, &quot;Circuit Timeslot List&quot;
You will need to do some modifying but I know the commands work with outlook.
 
Try modifying it with this one.
DoCmd.OpenReport &quot;rptProjects&quot;, acViewPreview, , &quot;[filter by if needed]= '&quot; & strVal & &quot;'&quot;
DoCmd.SendObject acSendReport, , acFormatXLS, &quot;Email address&quot;, , , &quot;Dear Rod&quot;, &quot;Attached is the quarterly Project Progress report for your info&quot;
DoCmd.Close acReport, &quot;Circuit Timeslot List&quot;
You will need to do some modifying but I know the commands work with outlook.
 
Try modifying it with this one.
DoCmd.OpenReport &quot;rptProjects&quot;, acViewPreview, , &quot;[filter by if needed]= '&quot; & strVal & &quot;'&quot;
DoCmd.SendObject acSendReport, , acFormatXLS, &quot;Email address&quot;, , , &quot;Dear Rod&quot;, &quot;Attached is the quarterly Project Progress report for your info&quot;
DoCmd.Close acReport, &quot;rptProjects&quot;
You will need to do some modifying but I know the commands work with outlook.
 
Sorry please go with the last one, my system had a bad hiccup.
 
Thanks a lot for your help. I tried and there was compile error. So I added the following declaration (I hope that this was right thing to do).

strVal as string

When I tried to run, I got the following message which I really don't know what does this mean. I hope it is not due to the declaration I made.

Statement invalid outside type block

Look forward receiving a reply from you!

Cheers

AK

Note: Using Access 97 - still.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top