parameter query by form

G

Guest

I have created a form to enter the parameters for a query. The parameters
you select on the form are the employee's id from a combobox and enter a
beginning date and an ending date. The query then does some calculations on
the data for that employee between those dates and shows you the results in
an actual query window. I would like, instead of seeing the query, to see
the results in textboxes on another form, single form view. Is that enough
info for help? Thanks :)
 
F

fredg

I have created a form to enter the parameters for a query. The parameters
you select on the form are the employee's id from a combobox and enter a
beginning date and an ending date. The query then does some calculations on
the data for that employee between those dates and shows you the results in
an actual query window. I would like, instead of seeing the query, to see
the results in textboxes on another form, single form view. Is that enough
info for help? Thanks :)

Create the other form, using this query as it's record source.
When the form displays all the data properly, delete the name of the
query from the form's record source, i.e. leave the recordsource
property blank.

Code this form's Open Event:

DoCmd.OpenForm "NameOfYourParameterForm", , , , , acDialog
Me.Recordsource = "NameOfYourQuery"
DoCmd.Close acForm, "NameOfYour ParameterForm"

Then change the command button click event on your Parameter Form from
whatever you already have to:

Me.Visible = False

To run all of this, open the form that will display the query results.
It will open your parameter form. After you enter the employee ID and
the dates, click the command button on the parameter form.
The parameter form will hide, then close.
The query records will be displayed on the form.
 
G

Guest

Perfect. Simple as that. :)

fredg said:
Create the other form, using this query as it's record source.
When the form displays all the data properly, delete the name of the
query from the form's record source, i.e. leave the recordsource
property blank.

Code this form's Open Event:

DoCmd.OpenForm "NameOfYourParameterForm", , , , , acDialog
Me.Recordsource = "NameOfYourQuery"
DoCmd.Close acForm, "NameOfYour ParameterForm"

Then change the command button click event on your Parameter Form from
whatever you already have to:

Me.Visible = False

To run all of this, open the form that will display the query results.
It will open your parameter form. After you enter the employee ID and
the dates, click the command button on the parameter form.
The parameter form will hide, then close.
The query records will be displayed on 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

Top