Relationship, combo box, parameter query

J

joni

Hello,
I have 2 tables:
Table1
Locker Number
Lastname
Firstname
StatusID(number) combo box

Table2
StatusID(autonumber)
Status(Text) - occupied, empty, pending

I created a one-to-many relationship.
I want to create a query to see all "occupied" lockers. i created a
parameter query:
SELECT *
FROM Table1
WHERE StatusID=[Enter Status:];
but instead of entering occupied, i have to enter 1 to see all the list of
occupied lockers.Can i just input the word occupied instead of 1 here, this
is also goes for empty (2) and pending (3)
 
O

Ofer

Create a query, add both tables to the query and join them by the StatusID
field.
Then create a filter on the Status field

SELECT Table1.*, Table2.[Status]
FROM Table1INNER JOIN Table2 ON Table1.StatusID = Table2.StatusID
Where Table2.[Status] = [Pleas enter status]
 
J

Jim Ory

My suggestion is:
Actually, you don't need two tables to do what you want. Each locker will
have a status assigned to it. You can not assign more than one status to the
locker. The status should be in table 1, not table 2. Table two you can use
as a 'lookup' table.

Table1
Locker Number
Lastname
Firstname
Status

Table 2
Status (make it the basis for a combo box)
Occupied
Empty
Pending

Enter criteria in the query as [Enter Status].

When you run the query, it will ask you for Status, type in one of those you
wish to locate, press OK.
 

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