Macro to print form

Rowena

Registered User.
Local time
Today, 03:37
Joined
Jul 16, 2002
Messages
27
Greetings.
I wrote my first macro yesterday. It is supposed to print a report from the form a user has open on screen, showing customer info and the jobs done for that customer.

As far as printing the correct info on the report, it works fine.
Unfortunately, it also wants to print a copy of the open form. All I really want to do is print the report.

The first action is OpenReport, and the "where" condition is
[Customers]![CUSTID]=[Forms]![CustomerInfo]![CUSTID]

CUSTID is the primary key field that links all the rest. CustomerInfo is the form I want to print the report from.
Then it does a PrintOut action, and I have it printing "selection".

Is there a way to limit what prints out? Do I need to tell it to print "pages" and if so, how do I limit it to the ones I need? (the report can be a variable number of pages)
Should I just go in and mark all items on the form "Screen only" or is there a more elegant way?

Please bear in mind that I'm a total newbie at this!

Thanks in advance, :)
Rowena
 
First bit, to print the report from a button on the form, put this on the OnClick event of the button.

DoCmd.OpenReport "rptName", acViewNormal, , "[CustID] =" & Forms![frmCustInfo]![CustID]

Got a bit confused with the next bit. Lets see if we can sort the first bit and then tackle the next bit.
 
It works!!!
It prints just the page(s) I need, with the appropriate info, and not the form itself!

The macro was actually also printing the report; but it was also printing the underlying form. I just wasn't sure how to get only the report.

Thank you! That's exactly what I needed! :)

Rowena
 

Users who are viewing this thread

Back
Top Bottom