Many thank for that I just have one further query. The above works well for the sample dataset I gave but I'm not sure how it would apply to the actual dataset I'm using as it is a little more complex. Basically, I have a very large dataset containing insurance policy transaction information for commercial property risks (so all the historic renewals etc). Each policy has a unique policy number and within each policy there are multiple locations. Within each of these locations there is a historic set of transactions each with a unique sequence number. When you go into one of these sequences you get a list of all the poperties in a scroll screen.The property details are stored in a seperate file but I the common link between the two is policy_no||policy_location||policy_seq. Now the main data set will have all the sequences with no gaps so the sequence numbers will range from 1 to, say 150, and the latest one is always 99999. So the sequence is 1,2,3,...,149,150,99999. The scroll screen with the property details is only update each time a building is added or deleted so the sequence has gaps. So, using the example above, the sequence in the scroll screen might be 1,5,13,24,144. The scroll screen with sequence 1 will be attached to the main dataset with sequence 1-4; the scroll screen with sequence 5 will be attached to the main dataset with sequence 5 to 12, and so on... The scroll screen with sequence 144 will be attached to the main dataset with sequence 144 to 99999. The main dataset contains 100s of policies with 1000s of locations and 10000s of sequence numbers. So my question is if the above code can be adjusted to allow for this i.e. repeat the process above for every location for every policy? Many thanks
... View more