Query based on group that excludes source record

Rx_

Nothing In Moderation
Local time
Today, 13:30
Joined
Oct 22, 2009
Messages
2,803
A query to populate a list box.
A Rocket_ID (IDR) sits on a Pad A Pad can contain several rockets
When IDR 1001 is selected - the query will use th eID_Pad 500005 to filter and show all of the other Records with ID_Pad 500005
EXCEPT for the IDR 1001

I could do this with a VBA Recordset, but expect that there is an easy way to do this as query.
The IDR is a PK and the ID_Pad is a FK

IDR ID_Pad D1 D2
1001 500005 10 20
1002 500005 12 22
1003 500005 11 21
1004 500005 16 20
1105 500007 11 20
1106 500007 12 20
 
I'm probably misunderstanding, but:

WHERE ID_Pad = 500005 AND IDR <> 1001
 
Sure enough it worked in sequence!.

I used a Not In(1001)
To select the PK, I

The query has the PTable joined to PTable1 where ID_Pad are equal
The first list box supplies the IDR = (list box IDR selected)

The 2nd listbox record source uses PTable1 where Not In(1001) (again the selected IDR from Table.

The result, the first list box is the single IDR selected by the user.
The 2nd list box is all of the other IDR sharing the same Pad, minus the one selected in the first lixtbox.

It sounds so easy after a cup of coffee.
Thanks
 

Users who are viewing this thread

Back
Top Bottom