Parameter box from criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to make the parameter box (the window that pops up when you
run a query when you've entered a statement in the criteria area of the SQL
statement design window) a drop down list/combo box so the user can choose
from a list instead of trying to remember exactly how the data was entered.

thanks for a any and all help and suggestions.
 
Is there any way to make the parameter box (the window that pops up when you
run a query when you've entered a statement in the criteria area of the SQL
statement design window) a drop down list/combo box so the user can choose
from a list instead of trying to remember exactly how the data was entered.

thanks for a any and all help and suggestions.

If the query is the end of the process rather than the record source
of a report:

You cannot use a combo box in the parameter prompt.

You'll need to use a form to do this.
Substitute you actual field names below.

Make a new unbound form.
Add a combo box that will show the CircuitID field.
Make sure the Combo Box Bound Column is the
same DataType as the CircuitID field.

Add a command button.
Code the button's Click event:

DoCmd.OpenQuery "QueryName"
DoCmd.Close acForm, Me.Name

Name this form "ParamForm"

Code the Query CircuitID field criteria line
forms!ParamForm!ComboBoxName

Open the form.
Find the CircuitID in the combo box.
Click the command button.

The query will display just those records selected.
The Form will close.
 
Thanks for the info. Actually it is to query for a report. The user will
need to be able to select specific data when running the report (i.e. Please
choose the company name). I am new to this, so maybe you can give me more
guidelines.

Thanks
 
Thanks for the info. Actually it is to query for a report. The user will
need to be able to select specific data when running the report (i.e. Please
choose the company name). I am new to this, so maybe you can give me more
guidelines.

Thanks
*** snipped ***

Yes, that's why I clarified my reply. It's similar but not the same.
Change the field names as needed.
if you don't need to filter the report by date, don't add the 2 text
controls to the form, nor use the data field in the query as criteria,

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 it's Column Count property to 2.
Set the Column Width property to 0";1"

Also add 2 unbound text controls.
Set their format to a valid date format.
Name them "StartDate" and "EndDate"

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

Me.Visible = False

Name this form 'ParamForm'.

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

As criteria in the query date field write:
Between forms!Paramform!StartDate and forms!ParamForm!EndDate

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 and the
entry of the starting and ending dates wanted.
Click the command button and then report will run.
When the report closes, it will close the form.
 

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