How do I make a Query ask for more than one parameter?

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

Guest

When you are in a query, and you want to pull up more than one group of
information when you run a query, how do you do that?

An example is if I have a list of say group names with individuals tied to
those names, and I want to pull up more than one group name to be viewed in
that query, is that possible. I know how to get a range of information, is
that even close to the same thought pattern?

If this is possilble, how would you do it?
 
James,

This seems like it would only work if you are looking for the same number of groups each time.

For example, lets say you want to return 2 groups. In the Criteria for your Groups field, you would enter:

[Please enter 1st group] or [Please enter 2nd group]

This should prompt you twice for groups and you would enter a single group into each input box.

If you are looking for 3 groups every time, then you would enter:

[Please enter 1st group] or [Please enter 2nd group] or [Please enter 3rd group]

You would get 3 prompts.

If you are looking to search for a different number of groups each time, you would probably have to create a form and use VBA code
in order to get it to work. Don't quote me on that though. Maybe someone more knowledgeable than me might know of a way around
that.

Also, if your Group field is a text field, you might need to do something like this:

" & [Please enter 1st group] & " or " & [Please enter 2nd group] & " or " & [Please enter 3rd group] &"

OR

# & [Please enter 1st group] & # or # & [Please enter 2nd group] & # or # & [Please enter 3rd group] & #
for a Date field (I know, you aren't going to have dates as a Group field. That was just to show you how you would do it if you
needed to do something similar for a date field)

I hope this helps,

Conan Kelly
 
James

I'm having trouble visualizing what your underlying data structure looks
like. Since queries run against data, it would help to know that structure.

For instance, how have you connected individuals and groupnames? This is a
classic "many-to-many" data situation, and requires use of a third
(resolver/join) table in a relational database like Access.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top