Unusual query request

KACJR

Registered User.
Local time
Today, 17:21
Joined
Jul 26, 2012
Messages
98
Greetings to the well of knowledge...

I have received an unusual query request that I need help to put together:

I have a table of clients. For each client, there may be one or more family members identified. We are going to be doing a mailing out to all family members but in order to save postage, we want to combine all family members living at the same address into one mailing.

The table of clients looks like this:

ClientName ClientAddress ClientCity ClientState ClientZIP FamilyName FamilyAddress FamilyCity FamilyState FamilyZIP Aardvark/John// 1 A Street Brighton MA 02135-5955 Aardvark/William// 1 A Street Brighton MA 02135-5955 Aardvark/John// 1 A Street Brighton MA 02135-5955 Aardvark/Olivia// 1 A Street Brighton MA 02135-5955 Antelope/Mary// 2 B Street Hyde Park MA 02136-2926 Antelope/Richard// 2 B Street Hyde Park MA 02136-2926 Antelope/Mary// 2 B Street Hyde Park MA 02136-2926 Antelope/Rhonda// 2 B Street Hyde Park MA 02136-2926 Albatross/Daniel// 3 C Street Tyngsboro MA 01879-5303 Albatross/David// 4 D Street N Billerica MA 01862-2844 Albatross/Daniel// 3 C Street Tyngsboro MA 01879-5303 Albatross/Denise// 4 D Street N Billerica MA 01862-2844 Alpaca/Alicia// 5 E Street Mattapan MA 02126-3157 Alpaca/Jennifer// 6 F Street Quincy MA 02169-6433 Alpaca/Alicia// 5 E Street Mattapan MA 02126-3157 Alpaca/Joseph// 6 F Street Quincy MA 02169-6433 Alpaca/Alicia// 5 E Street Mattapan MA 02126-3157 Armadillo/Stephen// 7 G Street Hingham MA 02043-3660 Avocet/Gerald// 8 H Street Framingham MA 01702-6215 Avocet/Diane// 9 I Street Framingham MA 01702-6638 Badger/Bruce// 10 J Street Billerica MA 01821-4301 Badger/Barbara// 11 K Street Winthrop MA 02152-2206 Badger/Bruce// 10 J Street Billerica MA 01821-4301 Badger/Elizabeth// 11 K Street Winthrop MA 02152-2206 Bear/Judith// 12 L Street Framingham MA 01702-6583 Bear/Joel// 13 M Street Cranston RI 02920-6830 Bengal/Irene// 14 N Street Lowell MA 01852-2141 Bobcat/Brenda// 16 P Street Lowell MA 01852-2140
What I think I want is to transform the information to something like this:

ClientName ClientAddress ClientCity ClientState ClientZIP FamilyName-1 FamilyName-2 FamilyName-3 FamilyName-4 FamilyAddress FamilyCity FamilyState FamilyZIP Aardvark/John// 1 A Street Brighton MA 02135-5955 Aardvark/William// Aardvark/Olivia//

1 A Street Brighton MA 02135-5955 Antelope/Mary// 2 B Street Hyde Park MA 02136-2926 Antelope/Richard// Antelope/Rhonda//

2 B Street Hyde Park MA 02136-2926 Albatross/Daniel// 3 C Street Tyngsboro MA 01879-5303 Albatross/David// Albatross/Denise//

4 D Street N Billerica MA 01862-2844 Alpaca/Alicia// 5 E Street Mattapan MA 02126-3157 Alpaca/Jennifer// Alpaca/Joseph//

6 F Street Quincy MA 02169-6433 Alpaca/Alicia// 5 E Street Mattapan MA 02126-3157 Armadillo/Stephen//


7 G Street Hingham MA 02043-3660 Avocet/Gerald// 8 H Street Framingham MA 01702-6215 Avocet/Diane//


9 I Street Framingham MA 01702-6638 Badger/Bruce// 10 J Street Billerica MA 01821-4301 Badger/Barbara// Badger/Elizabeth//

11 K Street Winthrop MA 02152-2206 Bear/Judith// 12 L Street Framingham MA 01702-6583 Bear/Joel//


13 M Street Cranston RI 02920-6830 Bengal/Irene// 14 N Street Lowell MA 01852-2141 Bobcat/Brenda//


16 P Street Lowell MA 01852-2140
...the idea being to combine all family names at the same address onto one client record. From this, then, I can produce mailing labels.

Anybody out there ever try anything like this?

Regards,
Ken

 
Apologies. The tables don't look good when posted.
 
Let's see if I can explain this, then:

I think I need to transform...

Record I: Name A lives at Address 1
Record II: Name B lives at Address 1

...into...

Record I: Name A and Name B lives at Address 1.

There could be one or more records per Address.
 
I would create a temporary table (make table query), who had all addresses (select distinct), plus a blank field, (which should hold the names).
Then I would use a OpenRecordset, and a loop, to insert names in the blank field.
 
Hmmm...I'm not quite sure how I'd do that.
 
Ok - I've made a small example for you in the attached database, open the only form an hit the button on it, the result is as shown in the attached picture.
 

Attachments

  • ClientAndAddress.jpg
    ClientAndAddress.jpg
    70.6 KB · Views: 117
  • ClientAndAddress.accdb
    ClientAndAddress.accdb
    480 KB · Views: 106
You're welcome - luck with your project.
 

Users who are viewing this thread

Back
Top Bottom