View Full Version : get unused numbers from a row of numbers


lala
03-20-2002, 07:43 AM
I have to make a report that will display what numbers haven't been used in the ID field.

I have a field, JournalEntryID, that is not autonumber and is filled in by a user. I have to make a report for him that will show him all numbers that he forgot to use. For example, if he has JournalEntryID's 1,3,4,5,8,9 - the report will show 2,6,7.

How can I do that?

Harry
03-20-2002, 07:51 AM
Might be long winded but:

Create a new table called Nums with one field called EntryID. Fill the table with all the numbers that he will use.

Now create a query with the following SQL code {note have called the table with JournalEntryID Journal}

SELECT DISTINCTROW Nums.EntryID
FROM Nums LEFT JOIN Journal ON Nums.EntryID = Journal.JournalEntryID
WHERE Journal.JournalEntryID Is Null;

This will create a list of available numbers that you can use in a report

HTH

lala
03-20-2002, 09:12 AM
thank you very much!!!
it worked