Use Parameters in queries and reports

G

Guest

I have follow steps by steps instructions under the "Use Parameters in
queries and reports" to create a parameter collector so that the query table
will display the stock name which i selected.

But the macro seems like does not link the form and the query.

I have done this:

1. Create a form where the user can use the combo box to select stock name.
2. Create the macro as details under the "Use Parameters in queries and
reports"
3. And in queries under the stock name criteria column, i have typed this
"[Forms]![Stock List]![Stock Name]
4. But when i run the Form and selected the stock name i wanted. Nothing
appear.

Please help.

Thank
 
G

Guest

Don't use a macro, use VBA instead

On the OnClick event of the button in the form, that open the Report (I
assume that what you want to print), write the code that filter the report
using the where condition of the Open Report command line
1. Base the report on all the records, no filter
2. Use that code

Dim MyCondition As String
MyCondition = "[Stock Name] = """ & [Stock Name] & """"
Docmd.OpenReport "ReportName" , , ,MyCondition

================
If you want to open a query that include the filter you speified, run the code

Docmd.OpenQuery "QueryName"
 

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

Top