Linking combo boxes to queries to reports

K

KeffinJ

Hi all,

I have a table (CountryPop). It contains a list of 20 countries and the
populations of those countries. I have another table (Rain) that contains a
list of 20 countries and the average rainfall in that country.

I have a form with 3 combo boxes. Each combo box has a list of 20 counties
(sourced from CountryPop table).

I want to be able to select 3 different countries from the combo boxes,
which pulls up a report that tells me the populations and rainfall for each
of the countires I selected from my form and also runs a total of the
population.

This is a very simplified version of what I am trying to do...but I kind of
want to put it out there this way - there is a vital step that I am missing.
I think that I can't get the selections from the combo boxes to interact with
a query (I assume I base my report on this query).

Can anybody point me in the right direction please?

Kevin
 
K

KeffinJ

Just so I don't waste anyone's time - I'm nearly there!

I was trying to make things far too complex, and once I realized that,
Doug's response from an earlier post made sense.

The secret was in the query and the VBA. In the query's criteria operator I
referred back to my form [Forms]![Form1]![ComboBox1] and also entered another
line to refer back to the second combobox too [Forms]![Form1]![ComboBox2].

When I ran the query, it ran it using the criteria that I had selected in my
two combo boxes.

I made a report, which sourced the query and I entered my relevant fields
that I wanted to view.

Back to the form, I wrote a simple VBA statement in the After Update box for
the second combo box. The VBA simply directed Access to open up the report I
had just authored.

Eureka!

If there is a more efficient method, or if something is wrong with this way,
then let me know. I am trying to learn as much as I can by trawling through
the discussion boards!

Thanks for your inspiration.

Kevin
 

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