I am a total beginner with MS Access 2003 and all suggestions are gratefully recieve. I have a table that looks like this: -
Code:
[Record Number, INT (PK)] [IP Address varchar(50)] [Assigned Yes/No]
------ 1 ---------------------- 10.10.1.0 ------------------ Y
------ 2 ---------------------- 10.10.1.1 ------------------ Y
------ 3 ---------------------- 10.10.1.2 ------------------ N
------ 4 ---------------------- 10.10.1.3 ------------------ N
------ 5 ---------------------- 10.10.1.4 ------------------ N
------ 6 ---------------------- 10.10.1.5 ------------------ N
------ 7 ---------------------- 10.10.1.6 ------------------ N
------ 8 ---------------------- 10.10.1.7 ------------------ N
------ 9 ---------------------- 10.10.1.8 ------------------ N
------ 10 --------------------- 10.10.1.9 ------------------ N
------ 11 --------------------- 10.10.1.10 ----------------- N
------ 12 --------------------- 10.10.1.11 ----------------- N
(Sorry for the ugly formatting. could not work out how to post it properly)
In this table I have around 60,000 records. The table lists all of my IP addresses in order.
I would like to know , if it's possible to create a query that can search through this table for a set number of free sequential records that have not been assigned.
So If I need a set of 6 free addresses, I would like to be able to search the table for 8 (6 hosts+1 subnet+1 broadcast) records that have false in the assigned column.
That's the first part to the challenge, the second is that the search would actually have to start it's checks in blocks of 8 too so that the subnet will actually work when someone tries to use them.
In the example above, the first 8 free addresses cannot be used for a subnet of 8 because they do not start on a boundary of 8. I would need the query to try searching from 0 for 8, then jump to record 9 and look for 8 and keep jumping til it finds 8 contiguous records starting from one of the records that are a multiple of 8.
I hope this makes sense.
Is a query the best way to do this? Is there a better way to do it?
Even if I could get an example of how to do either of these steps, it would be a place to start from.
Thanks