generating, printing shipping report - need help

bricklebrit

Registered User.
Local time
Today, 12:00
Joined
Feb 10, 2002
Messages
41
Hello,

I have been using the M$'s Northwind DB as an example and I would like to have a button on my order form to print out an invoice/shipping report of only the order you on working on?

The Northwind DB has a Print Invoice button which I can't figure out how it works! My northwind nwind80.hlp file is missing and I can't find where to down another one in hopes that it would explain how that button works.

Could anybody here shead any light on how to make a button like that?

Thanks in advance!
 
You could do this a couple of ways

1 create a query for the report and in the criteria for the unique id number for the record on the form build an expression back to the form: Forms![formname]![UniqueIDfield]. Obviously you will need to rename the form name and field name with the correct names!

On the command button OnClick event:

DoCmd.OpenReport, "YourReportName",acPreview

This way has the query filtering the report to show the record related to the current record on the form.

2

On the OnClick event of the command button do:

DoCmd.OpenReport, "YourReportName",acPreview
, , "[UniqueID] = " & Me![UniqueJob]

This tells the report to open in design view and show the records that matches the current record on your form.

Both do the same thing, only differently. I prefer version 2 because I can then open one report from various places (switchboard, dialog box, form) where if I used version 1 I would need three reports with three different queries
 
Thanks for your fast response! It seems like it should work, but I'm getting an error:

COMPILE ERROR:
ARGUMENT NOT OPTIONAL

I'm not sure what I'm doing wrong! My modified code from your suggestion is:


Private Sub printReport_Click()

DoCmd.OpenReport , "shipping_sheet_printout", acPreview, , "[OrderID] = " & Me![OrderID]

End Sub


---

I'm trying to search the report 'shipping_sheet_printout' for the corresponding OrderID number in my current form.

I guess I'm a little confused, do I need to create a query as an inbetween to search for the OrderID?

Thanks in advance for all your help!
 
Sorry, I think we have an extra ",". Try:

DoCmd.OpenReport "shipping_sheet_printout", acPreview, , "[OrderID] = " & Me![OrderID]


And take out the spaces in the report name. It's not good practice to use spaces in any object name! Access doesn't like it - it gets confused easily.

HTH
 
GREAT! Its works great! Thanks for all your assistance. Is there a way to make the report print automatically instead of just a print preview? I also noticed the Northwind database had a quick key assigned to the button -- is this a simple task?

Thanks again for all your prompt help!
 
Actually right after I posted that message, I tried the command acPrint which does print automatically.
smile.gif


Is there a way to assign a quickey to the button though?

Thanks again!
 
Don't know about a quick key but to print straight to the printer without previewing it first it would be:

DoCmd.OpenReport "shipping_sheet_printout", acNormal, , "[OrderID] = " & Me![OrderID]

Dawn
 
Things are working great ... except it keeps on wanting to print an extra page at the end of the report.

Ah.. sorry for flooding you with messages. For some reason my report insists on printing a seperate page at the end of the report. I thought perhaps it was some overlap outside the printable area, but it appears to be none. I scaled the report footer to 0 (which I suspect is what is printing a seperate page).

Is there a command on the button to just print page one? If not, is there a way to delete report footers all together?

Hottttt diggity, thanks for all the help.
 
I think I just found the answer .. it was not the Report Footer, but a ShipDateFooter than had an invisible entry in it that kept me printing an extra sheet of paper.

Thanks for all your help on this matter DB! It is greatly appreciated!
 

Users who are viewing this thread

Back
Top Bottom