StuartBombay
Programmer
I have a recordset with information on about 20,000 people, and each of those people belong to one of about 30 different post offices. I would like to create a tab del file for each post office with the file named after the post office and populated with the people who belong to it.
I would like the file name to be created on the fly, by reading the post office field name. I can have the record set sorted by post office easily enough so I should be able to just create the file, fill it up, close it and move on to the next.
I'm looking for suggestions. I have a couple ideas on how to do this, but would like to draw on some of your experience as well. Mostly, my brain is tired after getting the recordset together in a useful manner and have now hit the wall. If anyone can dash off a couple of lines to get me started I would be eternally grateful!
I picture it being something like:
Am I on the right track?
I would like the file name to be created on the fly, by reading the post office field name. I can have the record set sorted by post office easily enough so I should be able to just create the file, fill it up, close it and move on to the next.
I'm looking for suggestions. I have a couple ideas on how to do this, but would like to draw on some of your experience as well. Mostly, my brain is tired after getting the recordset together in a useful manner and have now hit the wall. If anyone can dash off a couple of lines to get me started I would be eternally grateful!
I picture it being something like:
Code:
open the recordset
read the the first file
put the PO in a variable
create the file
put the row in the file
read next
compare the PO to the variable
if it's the same put the row in the file
if it's different
close the file
reload the variable
create a new file
etc