A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Email Report



 
 
Thread Tools Display Modes
  #1  
Old December 5th, 2006, 12:06 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
SG
external usenet poster
 
Posts: 50
Default Email Report

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


  #2  
Old December 5th, 2006, 12:49 PM posted to microsoft.public.access.forms
dneagle via AccessMonster.com
external usenet poster
 
Posts: 10
Default Email Report

SG wrote:
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.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200612/1

  #3  
Old December 5th, 2006, 01:07 PM posted to microsoft.public.access.forms
SG
external usenet poster
 
Posts: 50
Default Email Report

I understand that bu where should I have the 'strWhere' statement?


"dneagle via AccessMonster.com" u8504@uwe wrote in message
news:6a4e5f3450e66@uwe...
SG wrote:
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.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200612/1



  #4  
Old December 5th, 2006, 03:21 PM posted to microsoft.public.access.forms,microsoft.public.access.formscoding
Brian
external usenet poster
 
Posts: 1,396
Default Email Report

Look at the syntax of the SendObject Method

expression.SendObject(ObjectType, ObjectName, OutputFormat, To, Cc, Bcc,
Subject, MessageText, EditMessage, TemplateFile)

This means. DoCmd.SendObject acSendReport, ReportName, ReportFormat, etc.

You have your strWhere in the place where you need the report's format, such
as acFormatHTML.

I don't think you can include your Where clause anywhere in the SendObject
method, but I would try including the where clause in the report itself by
adding criteria in its RecordSource referring to your parameters - replace
the implicit "Me" (which works in the context of the form but not the report)
with an explicit reference to the form. The criteria for InvoiceDate should
look something like this:

Between [Forms]![YourForm]![Startdate] and [Forms]![YourForm]![EndDate]

"SG" wrote:

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



  #5  
Old December 7th, 2006, 11:16 AM posted to microsoft.public.access.forms
dneagle via AccessMonster.com
external usenet poster
 
Posts: 10
Default Email Report

SG wrote:
I understand that bu where should I have the 'strWhere' statement?

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

[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

--
Message posted via http://www.accessmonster.com

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:48 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.