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

A97: Send single-record report to email

Status
Not open for further replies.

RonMcIntire

Technical User
Oct 12, 2002
166
US
All:

I wish to send a single-record report to email (Outlook Express).

I can preview a single record with the DoCmd.OpenReport methond and I can send the report (.rtf format) via the DoCmd.SendObject method but I would to do the following:

1. View the single record report.

2. Make the report show up in the message part of the email rather than as an attachment.

3. Include the email address, included in the record, in the "Send To" field.

How do I do it?

Thanks,

Ron

 
Here is what I Do... I would write code to accomplish that type of task... In below example, I am

Create a

lcObjectName = "qry_Review_User_And_Sec_Group_Approval"
Set rs = ThisDB.OpenRecordset(lcObjectName, dbOpenSnapshot)

If rs.RecordCount <> 0 Then
...
lcSubject = &quot;Daily Alert: &quot; & rsReports(&quot;REPORT_Name&quot;)
lcObjectName = lcQueryName
lcMessage=&quot;Text Where U Can Add to Body of EMail&quot;
'Perhaps Loop through Ur Query Record Set and Fill in message.

'E-Mail Report
llCheck = SendEMailOut(lcEMailAddress, lcSubject, lcMessage, lcObjectType, lcObjectName, lcFormatType)
..
If llCheck = False Then
MsgBox (&quot;Error Sending Emails&quot;)
Else
...
lcSQLLog = &quot;INSERT INTO tbl_Log (REPORT_TIME,QUERY_NAME,RECORD_COUNT,COMMENTS) &quot;
lcSQLLog = lcSQLLog & &quot;VALUES ('&quot; & lcTime & &quot;','&quot; & lcObjectName & &quot;',&quot; & rs.RecordCount & &quot;,'&quot; & lcComment & &quot;')&quot;
ThisDB.Execute lcSQLLog, dbFailOnError
End If
...


Public Function SendEMailOut(lcEM, lcSUBJ, lcMess, lcObjType, lcObjName, lcFormat) As Boolean
On Error GoTo Err_SendEMailOut
DoCmd.SendObject acSendQuery, lcObjName, acFormatXLS, lcEM, , , lcSUBJ, lcMess, False
SendEMailOut = True

Exit_SendEMailOut:
Exit Function

Err_SendEMailOut:
SendEMailOut = False
MsgBox Err.DESCRIPTION
Resume Exit_SendEMailOut
End Function

Steve Medvid
&quot;IT Consultant & Web Master&quot;
e-Mail: Stephen_Medvid@GMACM.com

Chester County, PA Residents
Please Show Your Support...
 
Steve:

Thanks for your response. It looks to be just exactly what I need.

Thanks again.

Ron
 
Glad to help. As a footnote, &quot;DoCmd.SendObject&quot; appears to have some difficulty under WinXP/Office XP. My group is reviewing a package called Redemption that circumvents the issue. Just something to keep in mind if moving to XP.

Steve Medvid
&quot;IT Consultant & Web Master&quot;
e-Mail: Stephen_Medvid@GMACM.com

Chester County, PA Residents
Please Show Your Support...
 
smedvid:

What's the latest on resolution to the problem of emailing reports from Access97 via "DoCmd.SendObject" under WinXP?

Thanks,

Ron McIntire
 
There are some solutions available... they are essentially third party work-arounds. One is comething called "Click Yes" and another is called "Redemption". There are a slew of others available also, but these two have been reviewed by some of the developers at my place and seem to work Ok. I had heard that MS was working on a solution also, perhaps put a new question on the board related to SendMail abd WinXP Security, for some other feedback..

Steve Medvid
&quot;IT Consultant & Web Master&quot;

Chester County, PA Residents
Please Show Your Support...
 
smedvid:

Thanks for your help. I'll check out these sources.

Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top