JamesHardiman
MIS
I have a DB that allocates guest numbers. Don't want to use AutoNumber, because I need sequential numbers.
Also, I want to re-use deleted numbers.
At present I do this:
intRangeLower = DLookup("RangeStart", "tblAvailableNumbersRanges", "TableName='" & t & "'"
intRangeUpper = DLookup("RangeEnd", "tblAvailableNumbersRanges", "TableName='" & t & "'"
s = "SELECT MIN(AvailableNumber) as n from tblAvailableNumbers " _
& "WHERE AvailableNumber NOT in (Select " & f & " from " & t & "
" _
& "AND AvailableNumber >= " & intRangeLower & " AND AvailableNumber <= " & intRangeUpper
which involves me having to have a table of numbers, and a table of ranges. All of which is a bit naff.
Basically, if I have a table that looks like this:
1 Fred Smith
2 Joan Smith
4 Anne Jones
I want a routine (SP, VB; I don't mind), that will return 3, this time, and after I've written away record 3, it will return 5.
Anyone any ideas?
James Hardiman
JamesH@sunsail.com
Also, I want to re-use deleted numbers.
At present I do this:
intRangeLower = DLookup("RangeStart", "tblAvailableNumbersRanges", "TableName='" & t & "'"
intRangeUpper = DLookup("RangeEnd", "tblAvailableNumbersRanges", "TableName='" & t & "'"
s = "SELECT MIN(AvailableNumber) as n from tblAvailableNumbers " _
& "WHERE AvailableNumber NOT in (Select " & f & " from " & t & "
& "AND AvailableNumber >= " & intRangeLower & " AND AvailableNumber <= " & intRangeUpper
which involves me having to have a table of numbers, and a table of ranges. All of which is a bit naff.
Basically, if I have a table that looks like this:
1 Fred Smith
2 Joan Smith
4 Anne Jones
I want a routine (SP, VB; I don't mind), that will return 3, this time, and after I've written away record 3, it will return 5.
Anyone any ideas?
James Hardiman
JamesH@sunsail.com