Is there a way to get mulitple specific records from 1 query

  • Thread starter diablowrym via AccessMonster.com
  • Start date
D

diablowrym via AccessMonster.com

Hello again folks,
I was wondering is someone could point me in the right direction.

What I need to do is build a query that we let me pull many specific records
at one time.

Say I had two tables:

Table 1 – employee info

EmID - pk
Name
Address
Etc

Table 2 – division

DivID – pk
Division Name
Address
Type
Etc
EmID – fk

I want to have a form that I can enter the EmID’s (as many as necessary) and
print a report from that form.
There is no other data besides the EmID that would differentiate the records.
Can this be done with a single query or do I need to have a query for each
EmId entry on the form?
If this question has been answered in the forums already please direct me
there, as I have had no luck finding it.

Thank you,
Point
 
D

Dorian

Yes, it can be done.
You would have a multi-select listbox on your form and a command button.
When the command button is clicked, you would programatically loop thru the
listbox selections and build the text of a query and then execute the query.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
M

Marshall Barton

diablowrym said:
What I need to do is build a query that we let me pull many specific records
at one time.

Say I had two tables:

Table 1 – employee info
EmID - pk
Name
Address
Etc

Table 2 – division
DivID – pk
Division Name
Address
Type
Etc
EmID – fk

I want to have a form that I can enter the EmID’s (as many as necessary) and
print a report from that form.
There is no other data besides the EmID that would differentiate the records.
Can this be done with a single query or do I need to have a query for each
EmId entry on the form?
If this question has been answered in the forums already please direct me
there, as I have had no luck finding it.


Well, this kind of question comes up occasionally, but it's
easier tor me to answer it than for me to search and review
other threads.

If you prefer to use a text box for users to enter a comma
delimited list of EmpIDs instead of using a multi-select
list box, then the query's WHERE clause could be similar to:

Forms!theform.thetextbox Like "*" & EmpID & "*"

It may need a little more than that depending on what your
EmpIDs look like.
 

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