Queries & Combo Box & Reports

  • Thread starter Thread starter Polina
  • Start date Start date
P

Polina

I have a table which feeds a query that has data for 5
locations. I need to create a query with a combo box that
asks the user to enter their desired location and other
aspects to return a report with only the locations they
want to look at. How can I do this. Thanks for any help.
 
I have a table which feeds a query that has data for 5
locations. I need to create a query with a combo box that
asks the user to enter their desired location and other
aspects to return a report with only the locations they
want to look at. How can I do this. Thanks for any help.

You can adapt this for your needs.

Create an unbound form.
Add a combo box.
Set the Row Source of the combo box to include the
CompanyID field and the Company Name.
Name the Combo Box 'FindCompany'.
Set it's Bound column to 1.
Set the Column Width property to 0";1"

Add a Command Button to the form.
Code the button's click event:

Me.Visible = False

Name this form 'ParamForm'.

In the Query (the Report's Record Source) [CompanyID] field criteria
line write:
forms!ParamForm!FindCompany

Next, code the report's Open event:
DoCmd.OpenForm "ParamForm", , , , , acDialog

Code the Report's Close event:
DoCmd.Close acForm, "ParamForm"

When ready to run the report, open the report.
The form will open and wait for the selection of the Company.
Click the command button and then report will run.
When the report closes, it will close the form.
You never see the query.
 
I thank you for your replay but if I already have a query
cant i creat a combo box which takes a feild in that
query and makes the user pick their location doing all
this with a comand botton? thank again
 
Would it be possible to have a combo box that just lists
the 5 locations and does a small filter instead of
letting me choose from all entries in the query that
feeds the form.
 
Back
Top