Email Report

S

SG

I have been trying to setup my reports so that the user can email them, I
have maged to do this but have came accross a problem when I have a where
clause see code below....

Private Sub Command8_Click()

Dim ReportName As String
Dim strWhere As String

ReportName = "SalesReport1"

strWhere = "InvoiceDate Between #" & _
Format(Me.Startdate, "mm/dd/yyyy") & "#" & _
" and #" & Format(Me.EndDate, "mm/dd/yyyy") & "#"

DoCmd.SendObject acReport, ReportName, strWhere
End Sub

The stWhere keeps appearing in the To feild of the email!


Any suggestions would be gratefuly recieved.

Thanks

S
 
D

dneagle via AccessMonster.com

SG said:
I have been trying to setup my reports so that the user can email them, I
have maged to do this but have came accross a problem when I have a where
clause see code below....

Private Sub Command8_Click()

Dim ReportName As String
Dim strWhere As String

ReportName = "SalesReport1"

strWhere = "InvoiceDate Between #" & _
Format(Me.Startdate, "mm/dd/yyyy") & "#" & _
" and #" & Format(Me.EndDate, "mm/dd/yyyy") & "#"

DoCmd.SendObject acReport, ReportName, strWhere
End Sub

The stWhere keeps appearing in the To feild of the email!

Any suggestions would be gratefuly recieved.

Thanks

S

You have missed out some parameters. The format for SendObject is this.

DoCmd.SendObject acSendReport, ReportName, acFormatRTF, SendTo, , ,
Subject, message
If you use the intellisense, it will show you what is required.
 
D

dneagle via AccessMonster.com

SG said:
I understand that bu where should I have the 'strWhere' statement?
[quoted text clipped - 27 lines]
Subject, message
If you use the intellisense, it will show you what is required.

It goes at the end. You still need a sent to parameter. You would be better
off taking the strWhere parameter from a query.

DoCmd.SendObject acSendReport, Report\Name, acFormatRTF, strTo, , strBCC,
strSubject, strWhere
 

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