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

[quote=Peter Jamieson;459888]You need to do one of the following:
a. specify the workgroup database name, and the appropriate user name
and password, in a connection string in VBA, e.g.

ActiveDocument.MailMerge.OPenDataSource _
Name:="the pathname of your DB", _
Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password=thepass word;" & _
"User ID=theuserID;Data Source=the pathname of your DB;" & _
"Jet OLEDB:System Database=the pathname of your workgroup DB;", _
SQLStatement:="SELECT * FROM [your table]

b. (you can probably do it by putting the same information in a .odc file)

Notice that in either case, the username/password info will probably end
up being rather easy to discover (in plain text in the .odc, and inside
the Word file in case (a))

Peter Jamieson

http://tips.pjmsn.me.uk

Peter, I already have VBA working in Access to run the merge. My problem is in setting up a document to point at the Access table as the source of the mail merge data. I have tried copying one of the documents that does point at the same table in the hope that it would still do so, but the copy points at an Excel spreadsheet of the same name.

Do I need to rename my workgroup information file, Secured.mdw, to System.mdw? I suspect that the New Data Source process will only look at a file of that name.

Are you suggesting that I put the VBA code in a module in the document?

Last edited by Murray Muspratt-Rouse : March 3rd 10 at 10:01 AM