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

Passing a Paramater to the query a report is based on 1

Status
Not open for further replies.

rstitzel

MIS
Apr 24, 2002
286
US
I have a form that a user can use to generate an invoice. The invoice number is automatically created and displayed on the form when the form is opened. When the user clicks the "Create/Print Invoice" button I want the invoice to automatically print. The problem I'm having is I don't know how to pass the invoice number that's on the form to the query the invoice "report" is based on. Now the user has to remember what the number is and print the invoice from another menu option.

note: In the query I have under the [Invoice Number] field [Please enter the invoice number you wish to print:]

Any and all help is appreciated.

Thanks
 
Hi

In on click event of the print (invoice) button

DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "rptInvoice", , ,"InvoiceNo = " & txtInvoice ' if InvoiceNo is a number column
DoCmd.OpenReport "rptInvoice", , ,"InvoiceNo = '" & txtInvoice & "'" ' if InvoiceNo is a string column

using the name of your repoprt, and of your controls 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