#1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Stacia Stacia is offline
external usenet poster
 
Posts: 1
Default Mail Merge

I have created a mail merge document using excel has the data base and word
as the document source. My problem is I have 36000 student address and need
to have a way to combine "unique address". Example: Larry Smith, 1613
Redwood, City, State, Zip: Harry Smith, 1613 Redwood, City, State, Zip.
What the district is wanting is Larry Smith, Harry Smith, 1613 Redwood, City,
State, Zip. Is there a quick way to do this with a mail merge?
--
Stacia
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Mail Merge

To do that, I would import the Excel data into Access and then use Access
MVP Duane Hookom's Concatentate Function in a query that you then use as the
data source.

Function Concatenate(pstrSQL As String, _
Optional pstrDelim As String = ", ") _
As String
'example
'tblFamily with FamID as numeric primary key
'tblFamMem with FamID, FirstName, DOB,...
'return a comma separated list of FirstNames
'for a FamID
' John, Mary, Susan
'in a Query
'SELECT FamID,
'Concatenate("SELECT FirstName FROM tblFamMem
' WHERE FamID =" & [FamID]) as FirstNames
'FROM tblFamily
'


'======For DAO uncomment next 4 lines=======
'====== comment out ADO below =======
'Dim db As DAO.Database
'Dim rs As DAO.Recordset
'Set db = CurrentDb
'Set rs = db.OpenRecordset(pstrSQL)


'======For ADO uncomment next two lines=====
'====== comment out DAO above ======
Dim rs As New ADODB.Recordset
rs.Open pstrSQL, CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
Dim strConcat As String 'build return string
With rs
If Not .EOF Then
.MoveFirst
Do While Not .EOF
strConcat = strConcat & _
.Fields(0) & pstrDelim
.MoveNext
Loop
End If
.Close
End With
Set rs = Nothing
'====== uncomment next line for DAO ========
'Set db = Nothing
If Len(strConcat) 0 Then
strConcat = Left(strConcat, _
Len(strConcat) - Len(pstrDelim))
End If
Concatenate = strConcat
End Function



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Stacia" wrote in message
...
I have created a mail merge document using excel has the data base and word
as the document source. My problem is I have 36000 student address and
need
to have a way to combine "unique address". Example: Larry Smith, 1613
Redwood, City, State, Zip: Harry Smith, 1613 Redwood, City, State, Zip.
What the district is wanting is Larry Smith, Harry Smith, 1613 Redwood,
City,
State, Zip. Is there a quick way to do this with a mail merge?
--
Stacia



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail-Merge: Can we have master detail relationship or multiple entities in word Mail-Merge? gmax2006 Microsoft Word Help 1 March 28th 07 06:28 PM
Take Mail Merge in Word back the the Mail Merge Helper 1,2,3 Form. Chris Green Mailmerge 5 October 8th 05 03:51 PM
collate pages in mail merge vs mail merge being single document Dan Schwab Mailmerge 2 September 14th 05 09:35 PM
Proteced Form with Mail Merge Section-Mail Merge is "lost" whe F. Ferrer Microsoft Word Help 0 February 2nd 05 09:27 PM
mail merge doc with further linked/embedded mail merge docs not playing the game Rob Cowlard Mailmerge 3 January 8th 05 10:15 AM


All times are GMT +1. The time now is 12:31 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"