Reply
 
Thread Tools Display Modes
  #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
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Connection to database fails

Of the top of my head, try changing

"User ID=Murray M-R;Date Source=" & strCurrentFileName & ";" &

to

"User ID=Murray M-R;Data Source=" & strCurrentFileName & ";" &

There could be other stuff but I'm glazing over right now!

Peter Jamieson

http://tips.pjmsn.me.uk

On 20/11/2009 20:22, Murray Muspratt-Rouse wrote:
"User ID=Murray M-R;Date Source="& strCurrentFileName& ";"&

  #3   Report Post  
Murray Muspratt-Rouse Murray Muspratt-Rouse is offline
Member
 
Location: Mill Hill, London, England
Posts: 44
Smile

Quote:
Originally Posted by Peter Jamieson View Post
Of the top of my head, try changing

"User ID=Murray M-R;Date Source=" & strCurrentFileName & ";" &

to

"User ID=Murray M-R;Data Source=" & strCurrentFileName & ";" &

There could be other stuff but I'm glazing over right now!

Peter Jamieson

http://tips.pjmsn.me.uk

On 20/11/2009 20:22, Murray Muspratt-Rouse wrote:
"User ID=Murray M-R;Date Source="& strCurrentFileName& ";"&
Dear Peter

You have done it again! As I said i could not see for looking. The problem was finally solved when I found that someone had made the MIBnew 2 folder 'Read only'

Now I go back to worrying about problems on my own PC.

Thanks again

Murray
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
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 11:07 AM
mailmerge from access database using DDE connection? Mike Mailmerge 3 January 11th 06 10:00 PM


All times are GMT +1. The time now is 08:11 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"