Hi
I recently had a similar problem, actual need was to find 'available' CostCentre numbers, given a list of used CostCentres and rules on how to derive a cost centre, logically similar to your problem
My solution may not be the most elegant, but it works heres is how I did it:
Create a table to hold list of available codes with a prime key of Code (Ip Address)
Write some code to generate a list of IP addresses, and insert a row into the table for each IP Address
Make a query which extracts only the unused addresses from this total list, something like
SELECT IpAddress FROM tblAllIps WHERE IpAddress NOT IN (SELECT ipAddress FROM tblEquipment) ORDER BY IpAddress;
Hope this works for you
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
UK