View Full Version : Query Problem


Madra Rua
08-10-2007, 03:17 AM
This is supposed to leave me with numbers 1 to 12 that have not been used
i.e. if 3 has been used the combo box should only show 1,2,4,5 etc

Pairs is a tbl with numbers 1 to 12

TestRecord is a tbl with 12 empty records

SELECT Pairs.Pairs, TestRecord.TestRecord
FROM Pairs LEFT JOIN TestRecord ON Pairs.Pairs = TestRecord.TestRecord
WHERE (((TestRecord.TestRecord) Is Null));

Hope that made sense

Madra Rua
08-10-2007, 03:18 AM
This is supposed to leave me with numbers 1 to 12 that have not been used
i.e. if 3 has been used the combo box should only show 1,2,4,5 etc

Pairs is a tbl with numbers 1 to 12

TestRecord is a tbl with 12 empty records

SELECT Pairs.Pairs, TestRecord.TestRecord
FROM Pairs LEFT JOIN TestRecord ON Pairs.Pairs = TestRecord.TestRecord
WHERE (((TestRecord.TestRecord) Is Null));

Hope that made sense

KeithG
08-10-2007, 04:37 AM
So if the number exists in table test record do not display the number?


try this

SELECT Pairs.Pairs, TestRecord.TestRecord from Pairs Where Pairs Not In (Select TestRecord from testRecord)

Madra Rua
08-10-2007, 04:57 AM
how do i cancel this thread and just run with the one above?

Bilbo_Baggins_Esq
08-10-2007, 04:58 AM
Hmmm,

If the source for the combo box is the query column for TestRecord.TestRecord, your combo box would be full of null values.

If the source for the combo box is the query column for Pairs.Pairs, your combo box would be full of the unused numbers.