Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2003 Vba Mailmerge

Status
Not open for further replies.

cornelius2

Programmer
Oct 19, 2008
1
BE
What is wrong in my Vba-code?
I thank you for your anser!
I am looking for a solution to execute mailmerge between a table in my current accessdatabase and a word-document.(access2003 vba-procedure).
The following vba-code always asks an connection between the word-document and the current access database. Next i receive a message "Contact systemadministrator, the access is refused. I give you my vba-library-references and the vba-code
Mijn verwijzingen in Vba zijn
Visual Basic for application
Microsoft Access 11.0 Object Library
Microsoft Word 11.0 Object Library
Microsoft Office 11.0 Object Library
Microsoft Visual Basic For Applications Extensibility 5.3
OLE AUTOMATION
Microft activex Data Objects 2.1 Library
Micorsoft DAO 3.6 Object library

Mijn Vba code
dim Vartable as string
VarTable = "MyTable"
Oword.ActiveDocument.MailMerge.OpenDataSource Name:="C:\MyAppl\MYDatabase.mdb", _
ConfirmConversions:=False, ReadOnly:=False, linktosource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;User ID =Admin;Password=xyz987;Data Source = C:\MyAppl\MYDatabase.mdb;Mode=Read;Extended Properties="""";Jet OLEDB:System database=C:\MyAppl\MYSystem.mdw;Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Lock", _
SQLStatement:="SELECT * from `" & VarTable & "`", _
sqlstatement1:="", SubType:=wdMergeSubTypeAccess
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top