View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Connecting to Access

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

On 02/03/2010 18:55, Murray Muspratt-Rouse wrote:
I have documents set up and working for mail merge run from Access 2003
through VBA to Word 2003. I want to set up a new document but cannot
get Word to connect to the Access database to pick up the table in
which the data will be stored.. When I go through the Open Data Source/
New Source dialogue, specifying the database to be used, the sign on is
rejected because the workgroup file is not found. How do I tell the
system where the workgroup file is held, or where can I put it so that
it will be found?