Pass parameters to a query

G

gavin

I've set up a database that has a combo box on a form to pass a parameter to
a query and it works really well. But now I need to be able to allow users
to select more than one item. The database is basically names and addresses
and the "area" field contains 8 choices. I guess I could have 8 combo boxes
on the form? But that doesn't seem a neat solution. Is there a better way of
doing this?

Thanks in advance for your time.
 
J

John W. Vinson

I've set up a database that has a combo box on a form to pass a parameter to
a query and it works really well. But now I need to be able to allow users
to select more than one item. The database is basically names and addresses
and the "area" field contains 8 choices. I guess I could have 8 combo boxes
on the form? But that doesn't seem a neat solution. Is there a better way of
doing this?

Thanks in advance for your time.

A Multiselect Listbox is another option. You'll need some VBA code to generate
the SQL of the query, though... not trivial but not too hard. There's sample
code at http://www.mvps.org/access/forms/frm0007.htm.
 
J

John W. Vinson

Thanks for trying to help me John but I fear that is beyond me.

If you could post the relevant fieldnames of your table and a bit more
description of what you want to accomplish, I or another volunteer can
probably help you write the code. It's a bit complicated but not TOO bad.
 
G

gavin

Thanks again, John. My database is at work so I'll grab it tomorrow and post
again tomorrow night.
 
J

John W. Vinson

Thanks again, John. My database is at work so I'll grab it tomorrow and post
again tomorrow night.

Please don't post *the database* - just the fieldnames and datatypes.
 
G

gavin

John W. Vinson said:
Please don't post *the database* - just the fieldnames and datatypes.

I would NEVER do that, John! But, guess what... I emailed the db to my home
email account - and our mail server at work blocked it! For some reason it
doesn't like unzipped Access dbs - and I forgot to zip it. Never mind.....
 

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