Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Murray Muspratt-Rouse Murray Muspratt-Rouse is offline
Member
 
Location: Mill Hill, London, England
Posts: 44
Smile Connection to database fails

This is a repeat of a problem I have had solved for me before - by Peter Jamieson, back in March. The problem has recurred in another system. Here is the code: -
strCurrentFileName = CurrentDb.Name
Set objApp = CreateObject("Word.Application")
objApp.Visible = False
'objApp.Activate
'Set objMMMD = objApp.Documents.Open(FileName:=strDocName)

objApp.Documents.Open FileName:=strDocName, ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False _
, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", _
WritePasswordTemplate:="", XMLTransform:=""

objApp.ActiveDocument.MailMerge.OpenDataSource Name:= _
"C:\MIBnew2\empty.odc", _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password=""pixie 7826"";" & _
"User ID=Murray M-R;Date Source=" & strCurrentFileName & ";" & _
"Mode=Read;Jet OLEDB:System database=\\Dove4\MIBnew2\Security1.mdw;" _
, SQLStatement:="SELECT * FROM `mergetable`", SQLStatement1:="", _
SubType:=wdMergeSubTypeAccess

This is where the pop up appears asking for input, quoting the user name and password set in the code above. I realise that I have made a mistake somewhere, but I cannot see it for looking!

The empty.odc file was constructed by using Notepad as Peter suggested.

Murray
 
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
Word 2000 fails DDE connection to Excel data kuzey Mailmerge 0 June 6th 08 10:28 AM
Insert Field Database only fails when I try to use filters Sherwood Mailmerge 3 September 13th 06 06:43 PM
How do I establish an OLE DB connection for an mde database? Dixie Mailmerge 1 August 17th 06 02:37 PM
ODBC connection Works w/Excel Fails w/Word snowman Mailmerge 1 January 22nd 06 10:07 AM
mailmerge from access database using DDE connection? Mike Mailmerge 3 January 11th 06 09:00 PM


All times are GMT +1. The time now is 08:24 AM.

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"