Well, you already sort the records by the computername, so just compare each record to the previous one. If they differ by more than one then there is a gap.

Here is one way of doing it:
Code:
$highNum = 0

For Each $record1 In $recordset1
If Not $highNum
$parseNum=CInt(Right($record1,5))
If $iNextNum AND $iNextNum<>$parseNum
$highNum=$iNextNum
"Gap found - using sequence number "+$highNum ?
Else
$iNextNum=$parseNum+1
EndIf
EndIf
Next
If Not $highNum $highNum=$iNextNum+1 EndIf



[edit]
Replaced the "EndIf" lost on the last line of the code during cut'n'paste.
[/edit]


Edited by Richard H. (2005-02-16 09:22 AM)