Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mail-Merge: Can we have master detail relationship or multiple entities in word Mail-Merge? | Microsoft Word Help | |||
Take Mail Merge in Word back the the Mail Merge Helper 1,2,3 Form. | Mailmerge | |||
collate pages in mail merge vs mail merge being single document | Mailmerge | |||
Proteced Form with Mail Merge Section-Mail Merge is "lost" whe | Microsoft Word Help | |||
mail merge doc with further linked/embedded mail merge docs not playing the game | Mailmerge |