Easy way to export queries to Excel with conditions?

Access9001

Registered User.
Local time
Today, 08:21
Joined
Feb 18, 2010
Messages
268
Say I have a query and one of the fields is State. How would I easily export this query into broken-up Excel files? For instance, one file containing every record where state="Atlanta," one where state="California," etc?
 
Thanks for the link! I'll have to check this out and see how it works.
 
This is a wonderful start but it's unfortunately quite slow for my use. This code requires that the query be executed for every Branch, which can be slow if the underlying query/table is huge. I'd ideally like to only execute once and then start chop-chop-chopping away from that.
 
Okay so what I am trying to do: Export the entire query to one excel file and then, from that excel file, export rows into different files based on a row condition. This way I don't have to run the SQL multiple times.

For instance, say I have this Excel output:

(columns A, B, C named Branch, Name, NumDays
Row 1: California, John, 10
Row 2: California, James, 2
Row 3: California, Tom, 4
Row 4: Denver, Mary, 5
Row 5: Denver, Paul, 4
Row 6: Rhode Island, Mark, 14

I want to be able to take that Excel file and create three files, Cali, Denver, and RI, with the same header as the source and the relevant rows ported over. Is there a good way to do this?
 

Users who are viewing this thread

Back
Top Bottom