query looking to form after is closes

  • Thread starter Thread starter Ken Ivins
  • Start date Start date
K

Ken Ivins

I have a form (frmCustomer) with a combo box cbxcuCounty which is a drop
down list of Counties. Else where I another combo box (cbxcuPlans) (on a
tab) of pricing plans based on the county of the customer. To achieve this
I created a query of all the plans that looks to the cbxcuCounty field then
returns only the plans and pricing for that county.

I thought this was great except that when I exit the form I get a Enter
Parameter Value asking for the value of the cbxcuCounty. I assume this means
part of the form or table is closing before other parts and it is trying to
query a field that is closed.

What can I do to avoid this or is there a better way to make this happen.

Thanks for your help.
 
Ken,
Are you running this query as a query to view the data,
or as the record source for a report?

If it is to view the query data, then add a command button to the form.
Code it's click event:

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

When you click the button to open the query, the parameters
will be passed, then the form will close.

If the query is a record source for a report, then:
Code the Form's command button click event:
Me.Visible = False

Code the Report Open event:
DoCmd.OpenForm "FormName", , , , , acDialog

Code the Report Close event:
DoCmd.Close acForm, "FormName"

Open the report. The report will open the form.
Enter your parameters. Click the command button.

The report will display. When you close the report it
closes the form.
 
I am using the query to enter data in to the table. Essentially I 6 options
per region. I have 8 Regions. Every county is assigned a region. So when you
choose a county, I want to limit the users options to the region the
customer is in and not choose an option in another region.
 
Back
Top