Zip: round robin using flag/counter
Posted on 2006-10-30
Ok, so I have 3 tables in my Access db (zipTable, csvTable, rrTable). I'm basically matching codes with zips between the 2 tables, zipTable and csvTable. However, I now to figure this piece out..If a zip within zipTable does NOT match a zip inside csvTable, then it should go through a round robin process and assign the code based on where the flag 'c' is and counter in table rrTable.
id code rr flag counter
1 abcd 2 c 0
2 etrg 4 o 0
3 qwse 6 o 0
So lets say it comes across a record (as it's looping through it) in csvTable that has zip 90025 but that zip doesn't exist in zipTable, then it would look in rrTable o see where the flag (c) was stopped and as in the example above, flag is stopped at id 1 So as you can see, rr = 2 and counter = 0, so then counter would now equal 1 and that record in csvTable would insert "abcd" into field Code in csvTable. On the next record without a matching zip, it looks at rrTable, sees where flag c is and again, counter=counter+1. Now if counter equals rr, then flag moves to next record. In this case above, code "etrg" would be inserted into that record. Any thoughts how this could be accomplished?