View Single Post
  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
DanielWalters6
 
Posts: n/a
Default Dynamic DataSource paths?

Thankyou for your help.

The .odc file method has worked.

When you said WORD always stores an absolute path I believe you're right.
WORD DID store a static file path. Although I used a file path which in
itself was dynamic (Hope you know what I mean)

I used .\DatabaseFileName.mdb as my filepath. Although WORD treats this is a
static, or absolute file path, the .\ is dynamic.

This allows word to look within the same folder as the document that you're
currently working on for the mdb file, databasefilename.

I can understand what you're getting at, and appreciate your help, and
believe that you're correct, when taking into account that the
STATIC/ABSOLUTE file path itself was DYNAMIC.

Hope you understand what I'm getting at, I'm struggling, but know what I
mean. :-)

Take Care

Dan

"Peter Jamieson" wrote:

This approach certainly won't work in its current form, because Word always
stores an "absolute" path to the data source, in this case the .odc file. If
you . In this case if you put all the files (say a.doc, a.mdb and a.odc) in
c:\a, make the connection, and go into the VB editor immediate window and
type

print activedocument.Mailmerge.DataSource.Name

the result will be c:\a\a.odc

so if you then distribute the files into c:\b, Word will still look for the
odc in c:\a and will not find it. Even if you use an OpenDataSource method
call to open the source and provide .\a.odc as the name, Word resolves the
name and stores it as c:\a\a.odc. So you /have/ to call OpenDataSource one
way or another, or let the user find the data source.

Being able to use relative paths would be great, but I don't know of any way
to do this other than the approach Cindy mentioned.

Peter Jamieson

"DanielWalters6" wrote in message
...
Dear Cindy, I have been in contact with another MVP who has suggested
another
way of getting over my problem. Could I run by his methods with you, to
see
if it will achieve what I am looking for? (I'm unable to access my
computer
for several days)
====
1. Create the filename.mdb file in Access 2003.
2. Create your Word doc and save it in the same folder as the mdb file.
3. Use the Word Mail Merge wizard to get recipients from an existing
list -
when prompted, double-click Connect to a New Data Source.odc - select
Other/Advanced, then Microsoft Jet 4.0 OLE DB provider, then specify the
path
.\filename.mdb, select the table in the mdb file that contains your
recipients, and save the data source as filename.odc in the same folder
as
the mdb and doc files, and sort / remove recipients from the list if
necessary.
4. Create your mail merge document.
5. Include the odc file with the doc and mdb files when you distribute the
solution.

I would like to know your opinion, if this will be easier to do that
creating the AutoOpen Marco that you talked about and also if they are
both
as dynamic as each other.

Thankyou, as a MVP, your opinions are valued.

Dan

"Cindy M -WordMVP-" wrote:


In a nutshell: it can't be done without the help of macro code.

Word's support of relative file paths is limited, and unstable at best.
They're
supported for IncludeText and IncludePicture fields, hyperlinks, but
that's
pretty much the extent of it. Certainly not for mail merge.

Best you could do would be an AutoOpen macro that gets the current path
of the
active document and plugs that into the basic connection information for
the
opendatasource method.

I'm currently in the process of creating a database.

I have a Word Document that contains a Mail Merge. The data source for
this
mail merge is an Access Database Query.

They are both stored within the same folder.

I want to distribute the Database with the Microsoft Word Mail Merge.

But I'm finding that when I move them, the Mail Merge is still trying
to
look up data that is stored in the original location of the database.

Which, obviously when put on a different computer/network drive doesn't
work. I presumed that it would be dynamic but it remains static.

I've spoken to a Teacher of I.T and computing and they suggested using
a dot
(.) and a backslash ( \ ) to make WORD look within the folder that the
mail
merge is stored in, and to find the filename that follows eg.

..\Databasefile.mdb

When I add this in, it still doesn't work. It accepts this as a file
name,
but still WORD looks for the original copy of the database when I'm
transporting it.

I COULD leave instructions for the end-user to update the file path of
the
database, but as this database will be transported around quite a lot,
this
will be a pain in the arse.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply
in the newsgroup and not by e-mail :-)