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 danielledunham on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I either print a report or send it as an attachment ?

Status
Not open for further replies.

testkitt2

Technical User
Apr 28, 2004
193
US
Hello everyone.....

I have a "Requisition for buying parts" that prints as a report.
The query asks you for the truck number, then your initials , then the
vendor and last who requested the parts. On the form there is a Checkbox
which needs to be checked "manually" (thats fine) and it will only print
those orders which have been checked off.
Here's what I'd like it to do...in addition to the above.. I'd like to give the user an option to print it or email it as an attachment with a yes or no command button. My SQL code below is set to only print the order.
I've searched the site...and tried some code snippets...but to no avail.
it must be me.... I'm not an expert....

Can someone lend a hand.....

Thanks JZ


Code:
SELECT Unit.Truck, Unit.[Vin #], Unit.Year, Unit.Make, Unit.Model, PartsDescription.DateLock, PartsDescription.Qty, PartsDescription.[Part No], PartsDescription.[Print Order], PartsDescription.Description, PartsDescription.Technician, PartsDescription.[Truck Status], PartsDescription.Comments, PartsDescription.Quotes, [Qty]*[Quotes] AS TPrice, tbVendor.[tbVendor Name], tbVendor.Address, tbVendor.Tel, tbVendor.Account, PartsDescription.Index
FROM tbVendor, Unit INNER JOIN PartsDescription ON Unit.Truck = PartsDescription.Truck
WHERE (((Unit.Truck)=[Enter Equipment or Stock]) AND ((PartsDescription.[Print Order])=Yes) AND ((PartsDescription.Technician)=[' Enter your first initial and last name to print requisition ']) AND ((tbVendor.[tbVendor Name]) Like [Enter The First Few Characters of the Vendor: ] & "*"));


Testkitt2
 
How about using a form to supply the parameters ([Forms]![frmForm]![txtEquipStock])?

Then your commad button code could be something like:
Code:
Private Sub cmdOutPutReport_Click()
If cboTextEmail = "Email" Then
    DoCmd.SendObject acSendReport, "rptReport", acFormatRTF, "someone@co.com", , , "Report", "This is the report"
Else
    DoCmd.OpenReport "rptReport", acViewPreview
End If
End Sub
 
Hey thanks Remou for your suggs..

There is a subform on the mainform (which I forgot to mention) that shows or better yet
is used to create the purchase orders..example...date quantity, description.. checkbox(Y/N) ...etc Then a command button on the mainform that says "Print Order"

Names on form is as follows"

Main form is called: "frmBackLogForm"
SubForm is called: "SubReq_Details"
Command button is called: "CmdPrintOrder"
Report is called: "frmMaterial Requisition"

All without "quotes"

would I still need to setup another form to do this?
Thanks



Testkitt2
 
No, I don't think so, though it is quite late here ([dazed]). I would imagine a set-up where your report echoes the form (main report , sub report) and draws the data or parameters from the form. It would be quite easy to use the recordsources and filters etc from the form as recordsources etc for the report and subreport. Is this in line with what you are thinking?
 
Thanks Remou,

Yes that's what I was thinking...
One of the main criterias used in the DB is checkbox factor..If the checkbox is checked off in the subform..(because you can have new and old data in the subform and the only one or ones you want to select is those that have the checkbox ..checked off).
The query "works" fine... when you click "Print Order" it asks for some criteria...when done...it prints one order for one vendor with one of more lines checked off in the "datasheet". (Each line in the subform (datasheet)is a diff part number...but the same vendor...
I no longer want to print the order ..I want to E-Mail it...but have it auto attach itself in a new composed message.

Thanks



Testkitt2
 
Well, if you are happy with the query, go with that. Your report is already built off this query, right? All you have to do is add a small form to ask for the criteria, rather than using the query itself. Change all the parameters such as [Enter Equipment or Stock] to reference controls on the form, for example, Forms![Form Name].[TextBox Name], then something like the snippet above to create either a report or email.
 
Thanks Remou,

I'm not quite sure on how to insert commands to open my email editor and attach the report..
can you help?

Thanks


Testkitt2
 
The line DoCmd.SendObject in my post above 17 Dec 05 18:49, will send an email with a report attached. (Check it out using intellisense). Create a command button with an On Click event and insert the snippet above, changing the names of reports etc to the names you need.

You could add an additional field to your print form to get an email address.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top