Passing Value from Form to Report/Query

  • Thread starter Thread starter Fakhruddin Zavery
  • Start date Start date
F

Fakhruddin Zavery

Hello,

I have a simple Invoice Report that when run it prompts for an Invoice No
and produces the report. It works fine.

However what I want to do is that when I'm on the Invoice form I want to put
a Button that calls the report and it should Automatically Pass the Invoice
No on the form to the Query Report. Is this possible?

Will appreciate all the help.
Thanks and Regards
 
Here is what I like to do. Go into the macro section of the database window
and create a new macro. Under "Action", choose "OpenReport". Near the
bottom of the macro screen are several boxes. In the Report Name box, put
the name of the report you want to open. The field is a dropdown box so it
makes it easy to find your report. In the "View" box, choose "Print
Preview". Leave the filter name blank. In the "Where Condition" box, enter
the following example: [QuoteNo] = [Forms]![frmQuoteEdit].[QuoteNo]

The first [QuoteNo] is the field on the report that you want to use to
display the report data. The sequence after the "=" is the corresponding
field on the form that displays the data you want the report to print. Save
the macro with an appropriate name of your choice. Close the macro screen.

Go to the form and place a command button on the form. Choose "run macro"
and select the name of the macro you created. Save the form.

With the form open and displaying the data you wish to print, click on the
command button. This should open the report showing the exact data you
want. Then you can go to the File -> Print menu and print the report.
Hope this is what you need. You can find more information on this by going
to the macro screen, placing your cursor in the "where condition" field, and
pressing F1.
Steve S.
 
Thanks guys, worked out just fine.

stevens said:
Here is what I like to do. Go into the macro section of the database window
and create a new macro. Under "Action", choose "OpenReport". Near the
bottom of the macro screen are several boxes. In the Report Name box, put
the name of the report you want to open. The field is a dropdown box so it
makes it easy to find your report. In the "View" box, choose "Print
Preview". Leave the filter name blank. In the "Where Condition" box, enter
the following example: [QuoteNo] = [Forms]![frmQuoteEdit].[QuoteNo]

The first [QuoteNo] is the field on the report that you want to use to
display the report data. The sequence after the "=" is the corresponding
field on the form that displays the data you want the report to print. Save
the macro with an appropriate name of your choice. Close the macro screen.

Go to the form and place a command button on the form. Choose "run macro"
and select the name of the macro you created. Save the form.

With the form open and displaying the data you wish to print, click on the
command button. This should open the report showing the exact data you
want. Then you can go to the File -> Print menu and print the report.
Hope this is what you need. You can find more information on this by going
to the macro screen, placing your cursor in the "where condition" field, and
pressing F1.
Steve S.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top