wilsonco18
06-28-2007, 10:08 AM
I am trying to find every person who is assigned to a room. Each person is assigend a room in a table called room assignment. Each person has a distinct room assignment ID. In the room assignment table, the room the person is assigned to is identified. I need to know how to query by room number, and then find all of the people associated to the room via the room assignment .
ajetrumpet
06-28-2007, 08:41 PM
It's easiest to do this is Design view, but if you've never done that before, type the following code into SQL view in the query.....(this is assuming your field names are PERSON, ID, and ROOM and your table is called ASSIGNMENTS)
SELECT PERSON.ASSIGNMENTS, ID.ASSIGNMENTS, ROOM.ASSIGNMENTS
FROM ASSIGNMENTS
WHERE ROOM=(type the value you want for ROOM here)
If the query keeps changing, use a parameter query so you can change the input value when prompted. Do you know how to do this?
wilsonco18
06-29-2007, 08:00 AM
is there a way to get the query to run without having to type in the room number every time---a way to get the query to run based on a list thats in another table?
ajetrumpet
06-29-2007, 08:56 AM
I am trying to find every person who is assigned to a room
If this is the purpose of the query, a parameter pop-up will work just fine. Yes you can run a query based on pretty much anything, but if the above quote of yours is true, why can't you use parameters? Why do it from another table? That would take more time and more steps....
boblarson
06-29-2007, 09:00 AM
First statement:
I need to know how to query by room number, and then find all of the people associated to the room via the room assignment .
Second statement:
is there a way to get the query to run without having to type in the room number every time---a way to get the query to run based on a list thats in another table?
Your statements conflict with one another. If you just want a list then you don't need the criteria. If you want to restrict it by a certain room, then you need the criteria. (if entering criteria, I suggest using a form for entry as you can refer back to it multiple times, if you keep it open)