Automate E-mail Snapshot of Report

  • Thread starter Brian Appleberry
  • Start date
B

Brian Appleberry

I had the following code in a database that would open a
report and create a snapshot of that report and put it
into an e-mail that worked fine for Access XP and prior.
Since upgrading to Access 2003, this code seems not to
work. Can someone please help. Is there modification to
the code that I need to change or is there a change in
Access 2003 that I need to make.

Private Sub ProcessData_Exit(Cancel As Integer)

On Error GoTo Err_ProcessData_Exit

Dim stDocName As String
Dim strReqNo As String
Dim Email As String

stDocName = "rptReqIT"
strReq = "ReqNo = Forms![frmReqHeaderIT]!ReqNo"
DoCmd.OpenReport stDocName, acViewPreview, , strReq
DoCmd.Maximize

Email = Me![VendorAggregate]
DoCmd.SendObject _
ObjectType:=acSendReport, _
ObjectName:=adhcReportName, _
OutputFormat:=acFormatSNP, _
Subject:="Purchase Requisition # " ' + Email ' _

Exit_ProcessData_Exit:
Exit Sub

Err_ProcessData_Exit:
Resume Exit_ProcessData_Exit

End Sub
 
T

Terry

I would think that the line
strReq = "ReqNo = Forms![frmReqHeaderIT]!ReqNo"

should, perhaps read
strReq = "ReqNo = " & &Forms![frmReqHeaderIT]!ReqNo
HTH
Terry
 
B

Brian

Well, I actually got it to work using the original code
that I posted. I changed my default printer to something
else and it seemed to work just fine. Why would a print
driver make a difference on whether a report opens and a
snapshot opens an e-mail?

-----Original Message-----
I would think that the line
strReq = "ReqNo = Forms![frmReqHeaderIT]!ReqNo"

should, perhaps read
strReq = "ReqNo = " & &Forms![frmReqHeaderIT]!ReqNo
HTH
Terry
-----Original Message-----
I had the following code in a database that would open a
report and create a snapshot of that report and put it
into an e-mail that worked fine for Access XP and prior.
Since upgrading to Access 2003, this code seems not to
work. Can someone please help. Is there modification to
the code that I need to change or is there a change in
Access 2003 that I need to make.

Private Sub ProcessData_Exit(Cancel As Integer)

On Error GoTo Err_ProcessData_Exit

Dim stDocName As String
Dim strReqNo As String
Dim Email As String

stDocName = "rptReqIT"
strReq = "ReqNo = Forms![frmReqHeaderIT]!ReqNo"
DoCmd.OpenReport stDocName, acViewPreview, , strReq
DoCmd.Maximize

Email = Me![VendorAggregate]
DoCmd.SendObject _
ObjectType:=acSendReport, _
ObjectName:=adhcReportName, _
OutputFormat:=acFormatSNP, _
Subject:="Purchase Requisition # " ' + Email ' _

Exit_ProcessData_Exit:
Exit Sub

Err_ProcessData_Exit:
Resume Exit_ProcessData_Exit

End Sub

.
.
 

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

Top