Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sequential Numbers Problem

Status
Not open for further replies.

solo7

Technical User
Mar 14, 2001
243
NO
I have a database which is accessed by different users, each putting in a unique field. This field is in essence a list of sequential numbers. My problem is that there are a few numbers missing in the sequence. How can I check this unique field and have the result displayed as a list of 'Missing Numbers' between the lowest value input and the highest value input ??

Steady ...
 
if records are in sequence then this should do it

dim db as database, rst as recordset
intcnt as interger
set db= currentdb
set rst = db.openrecordset("your table name")
rst.movefirst
for intcnt = (your first record#) to (yourlastrecord#)
if Intcnt = rst![yourrecord]then
rst.movenext
else
debug.print intcnt
end if
next
rst.close
set rst = nothing
end
My brain is low on caffeine this Am so you may have to play with the loop a bit but hopefully you get the idea.
 
I'm pretty sure this will have some interesting results in a multiuser environment (I would expect records to NOT be ordered by the "sequential value" field in a multiuser db, so the code would need to generate a recordset which includes " ... ORDER by SequentialValue ... " clause).

To really understand this problem, I would need to know how you are getting the 'sequential' number. It sounds like you are attempting to use an AutoNumber concept, but may not assigning the field as an autonumber data type. If this is the case, see faq700-184 for an alternative.


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top