Re: insert DATABASE within mailmerge
- From: Cindy M -WordMVP- <C.Meister-C@xxxxxxxxxx>
- Date: Mon, 12 Dec 2005 11:05:56 +0100
Hi =?Utf-8?B?bmF0ZQ==?=,
> essentially I have a mail merge that produces headings and parameters for a
> DATABASE query, so for every mailmerge heading there is a new query that
> produces a table under that mailmerge heading.
> Problem is that I want to use me.path in order to fill the path to the
> database in the query vs. hard coding it. Below are some scratchy comments
> about what I have tried so far.
>
> when you do an insert -> DATABASE and use a mailmerge field inside of the
> text that you use for the DATABASE connection. I need to use the me.path in
> that as well but don't know how to replace that text.
> I know I can access that DATABASE text via:
> ActiveDocument.Fields(2).Code
> For example if I make a button and in the click event
> put a msgbox(ActiveDocument.Fields(2).Code)
> it will show me what is being used in the DATABASE query.
> But when I try to fill a string var with the correct code and stick that
> string into the ActiveDocument.Fields(2).Code object via:
> ActiveDocument.Fields(2).Code = tempstr
> it errors. maybe because I am running it inside the document.open() func.
> if not here then where do I run it? I can't do it manually via buttons etc.
> this is all suppose to be an automated process.
>
There's a chance that the string you're trying to use isn't valid, from Word's
POV. Have you tried manually changing a database field's code and updating the
field?
What error are you getting?
Do you realize you'll lose the embedded Mergefield if you replace the .Code?
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 :-)
.
- Follow-Ups:
- Re: insert DATABASE within mailmerge
- From: nate
- Re: insert DATABASE within mailmerge
- Prev by Date: Re: Setting Autotext "Look In" field
- Next by Date: Re: User Defined Object
- Previous by thread: Re: Setting Autotext "Look In" field
- Next by thread: Re: insert DATABASE within mailmerge
- Index(es):