OnPage Event Help

B

bgreer5050

In order to automatically email some reports with the report in the
message body instead of as an attachment I have created a form "Open
POs Query" with a on page event shown below. The problem is when I
goto the next page of the reprt a new email is generated as I wish, but

it uses the email address from the first page
(me![requestoremailaddress]). Every page in the report has a different

email address. Any ideas? I have tried putting the field in the page
header as opposed to the detail.


Thank you for any input.


Private Sub Report_Page()
DoCmd.OutputTo acOutputReport, "OpenPos Query", "MS-Dos

Text", "c:\temp.txt", False
DoCmd.TransferText acImprtDelim, , "tblTemp",
"c:\temp.txt", False
With CurrentDb().OpenRecordset("tblTemp")
Do Until .EOF
MessageContent = IIf(IsNull(![F1]), MessageContent,

MessageContent + ![F1] & vbCrLf)
.MoveNext
Loop
End With
CurrentDb().OpenRecordset("tblTemp").Close
DoCmd.SendObject acSendNoObject, , ,
Me![RequestorEmailAddress], , ", "**Open Purchase Orders",
MessageContent, False
DoCmd.DeleteObject acTable, "tblTemp"


End Sub

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

OnPage Event Help 0
Hello Email Help 0
OnPage event 2
Numeric Value Overflow - HELP??? 1
Timer event does not fire 1
Send email help 11
Delete a table using VBA 1
By Passing Reports with no data 3

Top