"Mark V." <ma**@victorynet.com> wrote in message
news:92*************************@posting.google.co m...
Here's what I have and I'm stumped. I have a table that has several
thousand names and addresses. I only want to send to one address in a
household. So what I would like to do is create a new column that runs
a macro or whatever it takes to flag records so they are housholded.
Some records have a Father and son at the same address, so I would
only want to generate a count in my query that gives me one record for
that household, a head of household flag. Some households have as many
as 4 people at the same address and apt. I have one field with the
combined address in it to query for these duplicates. Any suggestions.
Mark
This is courtesy of Patrick Finucane:
MklMorgan wrote:
trying to teach myself access. Question for the gurus out there:
I have a table with names and addresses (its a membership listing) that I
use to send out letters and whatnot. One of the reports is formatted to
address labels. Is there a way to combine married couples to one address label. As
set up currently both people can be paid members but when the report runs and
prints I get two labels per couple. One with each name, both with the same
address.
Ideally I would like the report to combine the two names to something like
Joe and Debra Smith
then the address but if thats not possible I would settle for a filter or
sort that lists only one of the names to avoid wasting labels.
Thanks in advance
Mike
Mk*******@aol.com
This is just a general off-the-top-of-my-head approach. You could
create a Yes/No field called UseThisPersonForLabels. Then present a
combo box that lists the records of people at that address. If only one
person, it would always be set to True. You'd requery the combo in the
OnCurrent event. If there were only 1 record (the current one), the
Yes/No would be set to True and the combo would be invisible. If more
than one, you would make the the combo visible and let the person set
the combo to the person to use. In the BeforeUpdate event, if more than
one record is at this address and this record is selected to be the
record to used for labels, check the other records and set their flag to
false. At the same time, if the address changed, you could update the
other records addresses....or ask if you want to update the other
addresses with the newaddress (see OldValue property).
Then in your query select all records with UseThisPersonForLabels =
True. You could then create a function that would pass the address and
return the names. Ex. In thd field row enter something like
AddressNames : GetAddressNames([Address],[LastName])
and the function would be something like
Private Function GetAddressNames(strAddress As String, strLastName As
String)
Dim strSQL As STring
Dim rst As Recordset
strSQL = "Select FirstName, LastName From Table Where Address = '" &
strAddress & "'"
set rst = currentdb.openrecordset(strSQL,dbopensnapshot)
rst.movefirst
Do While Not rst.Eof
GetAddressName = GetAddressNames & " & "
rst.MoveNext
Loop
' remove & and space at end of string
GetAddressNames = Left(GetAddressNames,Len(GetAddressNames) - 2)
'add the last name
GetAddressNames = GetAddressNames & strlastName
End Function
You would have to come up with a solution for people living at the same
address with different last names (wife didn't take hubby's name or
boy/girlfriend teams, stepfather/daughter situations.
In actuality, this might be a complicated problem because of variables
that can be introduced. In the long run, it might be cheaper to pay for
the extra label and postage vs the maintenance required to make this
work. Since both are paying for the membership, both should receive a
mailing....in my opinion.
But if you want to save some money on the mailing end, you'll be adding
money in maintenance on the computer end.
Also, if this is not a large list or dup addresses, you may want to
handwrite the labels of those that are dupes.
Either that or redesign the system so that you have a last name and
address field for the main record and make family members a subform in
another table that links to the recorrd ID. That's probably the best
way to do this...but you'll still need to write a function to
concatenate the first name records together similar to the one I
provided.