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

Run a report from a form

Status
Not open for further replies.

kammilla

Instructor
Jan 19, 2003
5
NO
I have a form based on 4 different tables. In the form I can register what is ordered from a table on a restaurant.
This order has an unique number.

I also have a report showing the same information, but with a different layout.
Printing out the report is based on a query where it is asked for the unique number of the bill.

My problem is:
How can I make a print of the report while standing in the form without beeing asked for the number of the bill??
 
Hi

On the form, have a command button, which opens the report using do.cmd.openform, and sets the appropriate parameter to a sutiable wheer clause (see help for syntax of DoCmd.OpenReport), you may need to save the record before printing as well, depending on if you are updating it within the form, so roughly

you need in teh onclick event of your command button

DoCmd.RunCommand acCmdSave Record
DoCmd.OpenReport "ReportName",..etc,"[BillId] = " & Me.BillId

Note I have assumed BillId is numeric type, if it is not you need it bounded by quotes so

DoCmd.OpenReport "ReportName",..etc,"[BillId] = '" & Me.BillId & "'"

using your control and object names of course

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top