find next available number with a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a predefined list of id's in a table named tracts. None of the other
fields in the tract table are populated. I want to use a query to find the
first available number in the tract table and use this to populate a combo
box. Available means the record is clean other than the predefined lists of
id's. Is this possible?
 
If you want the first available (singular) you do not need a combobox just a
text box.
Try this --
SELECT Min([TractID]) AS [Next Tract ID]
WHERE ([Field1] Is Null AND [Field2] Is Null AND [Field3] Is Null AND
[Field4] Is Null)
FROM [YourTable];
 
I have a predefined list of id's in a table named tracts. None of the other
fields in the tract table are populated. I want to use a query to find the
first available number in the tract table and use this to populate a combo
box. Available means the record is clean other than the predefined lists of
id's. Is this possible?

You can base the combo on a Query with a criterion of IS NULL on
whichever other fields constitute an "empty" record:

SELECT ID From Tracts
WHERE [thisfield] IS NULL AND [thatfield] IS NULL;

John W. Vinson[MVP]
 
Back
Top