C
C Marshall
I have a name badge document that I routinely merge with an Access data base
on a server. I create name badges for several offices. Each office is
generated with a make table and 2 append queries, with a query for the final
data.
The final data query for each office is used to create the name badges for
each office.
I recorded the merge process for one query, then copied for each office.
The code is:
Sub Merge_EventsDataBase_HOU()
'
' MailMerge Macro
' Macro recorded 8/17/2005 by cm9125
'
ActiveDocument.MailMerge.OpenDataSource Name:= _
"I:\Access\Registration_Lists_Pinnell\RegistrationLists_Original.mdb", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"QUERY Qry-N_B-Office-HOU-4-FinalData", SQLStatement:= _
"SELECT * FROM [Qry-N_B-Office-HOU-4-FinalData]", SQLStatement1:=""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
End Sub
Copied this code and changed the query name for each of the other offices.
This code ran fine, but when I tried the other offices got "Run-time error
'5922': Word was unable to open the data source."
Can someone help me with this? Also, on my computer it goes to the "I:"
drive. On someone else's computer it may not be "I:". Is there a way to let
the other user enter their drive number?
on a server. I create name badges for several offices. Each office is
generated with a make table and 2 append queries, with a query for the final
data.
The final data query for each office is used to create the name badges for
each office.
I recorded the merge process for one query, then copied for each office.
The code is:
Sub Merge_EventsDataBase_HOU()
'
' MailMerge Macro
' Macro recorded 8/17/2005 by cm9125
'
ActiveDocument.MailMerge.OpenDataSource Name:= _
"I:\Access\Registration_Lists_Pinnell\RegistrationLists_Original.mdb", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"QUERY Qry-N_B-Office-HOU-4-FinalData", SQLStatement:= _
"SELECT * FROM [Qry-N_B-Office-HOU-4-FinalData]", SQLStatement1:=""
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With
End Sub
Copied this code and changed the query name for each of the other offices.
This code ran fine, but when I tried the other offices got "Run-time error
'5922': Word was unable to open the data source."
Can someone help me with this? Also, on my computer it goes to the "I:"
drive. On someone else's computer it may not be "I:". Is there a way to let
the other user enter their drive number?