Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email Current Report only not whole database!

Status
Not open for further replies.

AccessXP

IS-IT--Management
Jan 29, 2002
132
I have a form that users input data. I need the user to click a button and send that current report as an email.
There is no query for this database.

When I try it the button works, but sends a report for the whole database.

Can someone please help!
 
You would need to set up a query that will limit what appears on the report. A query with a begining date and ending date parameters for the report. Or a query based on a particular field. That would depend on what you want to appear on the report that is e-mailed.

Give me a little more information and I may be able to help.

:)
 
Shirley,
Thanks for the quick response. I have a report designed already and that is the report I would like to use not what the query gives. Is there a way to use the report that was designed and not the query?

I know when you use the command button you can print that one report. So can the same be done with Email?

 
Try using some vb code like this on the click event:
DoCmd.SendObject acSendReport, "rptEMail", acFormatRTF, Names, , , _
"Recent Leave of Absence Added to the Program", , -1

This choose the rptEMail and the Recent Leave is what appears in the subject box on the email program.


 
Sirley,

I tried the line of code you gave to me, but it still is trying to email more than the current record/report.

HELP!
 
If you are trying to send just the current record try this code to narrow it down to this current record:

DoCmd.SendObject acSendReport, "rptEMail", acViewNormal, , "[StudID]=" & [StudID]

Try this code and see if it helps

See if this works
 
I tried the code you supplied first i get an error using (acViewNormal)so I changed it to the format I needed (acFormatHTML) and [studID] to [ID] and it still counts all records. Any ideas on what to do?

 
Do you have the button setup on the form? Usually when I preview or print a report from the form and use the last code it will only bring up one student's information. Try setting up a preview button on the form to view the report, see if this works:

Dim stDocName As String

stDocName = "rptEMailt"
DoCmd.OpenReport "rptEMail", acViewNormal, , "[StudID]=" & [StudID]

Do this first and see how it goes alright.
 
Okay I don't know if we are getting closer or not maybe you do.
Here is what i have for the button i just created.
Dim stDocName As String

stDocName = "Customer Information"
DoCmd.OpenReport "Customer Information", acViewNormal, , "[ID]=" & [ID]

This now prints the current reoprt which is good but now insted of print.... email.

Any idaes?
Thanks.
 
Check out the DoCmd.SendObject acSendReport function. If not just set up a parameter query which would ask for the customer id and connect it to the report. Sorry I'm not much help, but let me know how it turns out.

;-)
 
I have tried evrything Shirley advised but nothing worked.

I have read through a few books but still cannot find the answer. Can somebody help? Or is this not posible.

 
AccessXP

Not sure if I've got the situation here so I am asuming you have a record ID for the individual record your are trying to create the report for, so have you tried creating a text box on a form, entering the record number/id and clicking to send/print. The report can then refer back to the text box on your form (the value you typed in) to filter the report.

So if you had a Form called frmEmailReport and a text field call lblID on it then in your recordsource of the report in say ID field your criteria would be Forms![frmEmailReport]![lblID]

This should then pick up the value on your form.

Give me a shout if I confused you.

Cheers

Chris
 
is this using a query?

I do not have a query setup for this database.
 
Not sure if this helps you but i had the same problem getting the current RMA i was viewing to print without the hole database be dumped. This VB code was attached to a button on click event "Event Procedure"
Hope this helps you out.

The code is as follows

Private Sub print_preview_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "rma report"
strFilter = "[RMA#] = " & Me![RMA#]
DoCmd.OpenReport "rmareport", acViewPreview, , strFilter

End Sub
 
ChrisBelzona,

The only record source that I know of is the AutonumberID assigned in the tables, but it does not show on the report
just the table and the record sellect at the bottom of the form.

I hope this helps you.
 
SA812

I will give this code a try and let you know if it works.
Thanks for the reply.
 
Here is a question.

Does the report it self need a unique ID some where on the report? and if so can it be hidden form view when emailed?

well this help to solve the problem that i am having?
 
AccessXP

It may be easier for me to send you a example of what I'm talking about.

Leave me your e-mail and i'll send you something.

Cheers

Chris
 
ChrisBelzona,


Wtilson@bi-sol.com
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top