473,385 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SendObject problem

I have finally got "SendObject" to work but now have a filter problem.

I have a database set up that I generate orders and print them as a single
page report. I've set up a filter so that when I "onclick" the button it
simply prints the order I can see (ie if I've entered Order 0100 - it only
prints the one that is open in the form).

I want the command button to continue printing but to also send the single
page by e-mail. However, although the print is still only printing the one
report the e-mail is attaching all of them - I have about 250 orders and
they all get attached to an e-mail.

Another "would be nice" is to have the actual report format attached to the
e-mail instead of RTF (snapshot would be nice but I don't think it works
with SendObject)

Can any guru's look at the attached code and tell me what I am doing wrong.

Private Sub Command85_Click()
On Error GoTo Err_Command85_Click

Dim stDocName As String
Dim stFilter As String

stDocName = "RptSiteInstruction"
stFilter = "ID = Forms!FrmInstruction!ID"
DoCmd.OpenReport stDocName, acViewNormal, , stFilter
DoCmd.SendObject acSendReport, stDocName, acFormatRTF,
"ja**@email.address.au", , , "Subject Text", , True
Exit_Command85_Click:
Exit Sub

Err_Command85_Click:
MsgBox Err.Description
Resume Exit_Command85_Click

End Sub

--
John Taylor

Nov 13 '05 #1
1 2928
"John Taylor" <ja**@iinet.net.au> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au...
I have finally got "SendObject" to work but now have a filter problem.

I have a database set up that I generate orders and print them as a single
page report. I've set up a filter so that when I "onclick" the button it
simply prints the order I can see (ie if I've entered Order 0100 - it only
prints the one that is open in the form).

I want the command button to continue printing but to also send the single
page by e-mail. However, although the print is still only printing the one
report the e-mail is attaching all of them - I have about 250 orders and
they all get attached to an e-mail.

Another "would be nice" is to have the actual report format attached to the
e-mail instead of RTF (snapshot would be nice but I don't think it works with
SendObject)

Can any guru's look at the attached code and tell me what I am doing wrong.


The problem is that SendObject doesn't have an optional WHERE argument like
OpenReport does (your strFilter variable). There are several ways to get the
same effect.

If you open the report in print preview and leave it on the screen when you
issue the SendObject command it will inherit the filtered data being displayed
in the report on-screen.

You can have the Open event of the Report test a value, either a public variable
or a control on your form and use that to apply a filter to itself. This is the
method I generally use.

If you always want to print/send the report from this form and will always be
doing so for one record at a time you can modify the query that the Report uses
so that it picks up selection criteria from the form.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jay Bienvenu | last post by:
I am trying to execute a DoCmd.SendObject command to produce an email message from Access 2000. The command produces the email message, but the To:, CC: and BCC: fields are blank. The subject field...
0
by: Bret Shortall | last post by:
Using the SENDOBJECT action command in a Macro works fine if you hard code in their email address. SENDOBJECT TO bret@emailaddress.com SUBJECT This is the Subject line...
3
by: J Bunton | last post by:
DoCmd.SendObject Using windows2000 and OutLook Express v6 I have Access 2000 and Access 97 installed on the same machine. To achieve this and so that Access applications open with the...
4
by: Fred | last post by:
I want to insert DHL and FedEx tracking links with the waybill numbers in the body of emails I am sending using sendobject. I am not sending attachments. DHL and FedEx use long links that...
2
by: Lumpierbritches | last post by:
Hello, and thank you in advance for any and all assistance. I'm having a problem. This code worked years ago, what am I doing wrong? Private Sub SendeMail_Click() DoCmd.SendObject...
8
by: Andy Kasotia | last post by:
Warning message in Outlook 2003 while using SendObject. When i try to use sendobject to send an email, a warning massage pops up, saying that "Outlook is trying to send an email.......if this is...
3
by: Fred Zuckerman | last post by:
Hello All, I had written a quick email procedure for a client that uses DoCmd.SendObject. However they have the SR-1 version of Access 2K. They do not have the SP-3 upgrade. The procedure does...
2
by: Andy_Khosravi | last post by:
I posted this question about two days ago, but for some reason it never actually got put up. I couldn't' find it with searches, so I am re-posting it now. I apologize if this is a double post. ...
0
by: (PeteCresswell) | last post by:
Another thread got me going on SendObject. Works like a champ for emailing somebody a .SNP of a report as in: DoCmd.SendObject acSendReport, "rptMaturities", "Snapshot Format", "pCresswell", ,...
4
by: Ken OHanlon | last post by:
I have an Access 2003 question. It is about using SendObject and/or OutputTo. I want to be able to send an e-mail (Invoice) to my customer each and every time one of his employees comes into the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.