Text file output question

  • Thread starter Thread starter Jackson Brown
  • Start date Start date
J

Jackson Brown

Hi,

I wonder if someone out there can help me. I have tried to find a
solution myself but I don't really know where to start.

I have a large table of names and addresses and other details
(including a "suburb" field). What I would like to be able to do is
this: Output a separate text file for each suburb that has more than 3
people living in it, containing a list of the names and addresses of
the people in that suburb. There must be some way I can do this
automatically, right?

If someone could point me in the right direction it would be very much
appreciated.

cheers,
Jackson
 
Hi Jackson,
There are probably more high-tech and efficient ways to
do this, but the following should work.

1) create a query based on your table, with suburb field
included twice. Change this to a totals query. Leave the
first field with "group by". Also, unclick the show box
for the first field. Change the second one to "count".
In the criteria field for the 2nd occurrence of suburb,
enter >3. This will group by suburbs, count the
occurrences of each suburb, and return the suburbs where
the count is greater than 3.

2) create another query. Include the query from above and
your table. Join them by suburb field. Select the fields
that you want in your text file. This should give you the
people in the suburbs where there were more than 3 people.
 
Hi Jackson,
There are probably more high-tech and efficient ways to
do this, but the following should work.

1) create a query based on your table, with suburb field
included twice. Change this to a totals query. Leave the
first field with "group by". Also, unclick the show box
for the first field. Change the second one to "count".
In the criteria field for the 2nd occurrence of suburb,
enter >3. This will group by suburbs, count the
occurrences of each suburb, and return the suburbs where
the count is greater than 3.

2) create another query. Include the query from above and
your table. Join them by suburb field. Select the fields
that you want in your text file. This should give you the
people in the suburbs where there were more than 3 people.

Thanks a lot for your help - that worked great. Now all I need to do
is get Access to create the separate .txt files somehow.

cheers,
J
 
-----Original Message-----


Thanks a lot for your help - that worked great. Now all I need to do
is get Access to create the separate .txt files somehow.

cheers,
J
.
 
When you have the 2nd query open in design view, click
File, Save as Export. Select "to an external file or
database". This will take you to the export text wizard.
Follow the instructions there. Once that is done, you can
build a macro to run the queries for you.

Good luck.
 
Back
Top