Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
paul paul is offline
external usenet poster
 
Posts: 249
Default docvariable, template (.dot)

Hello
I have inherited a Word document template (.dot) that contains docvariable
fields in it that are populated from a VB-interface/Access database. I am
told that the application/DB push the data to this template, unlike a mail
merge (I believe).

My question is that I would like to add a new docvariable field and am able
to. However, after creating it, the field is displayed with the error
stating, "Error! Document variable not defined."

I am wondering how this field is associated with a specific field in the
database? The existing fields in the template all have past values in them.

Paul


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default docvariable, template (.dot)

A DOCVARIABLE /field/ gets its value from a Word Document Variable,
which would typically be created and populated by a bit of VBA code.

For example, there may be some Access VBA code which
a. opens the template, or a document based on the template
b. uses some code like

objDoc.Variables("the variable name").Value = some string value
obtained from the relevant table/field in Access

It is quite possible that "the variable name" would be the same as the
Access column name, e.g. if you had a column in Access caled "mycolumn",
you might have

objDoc.Variables("mycolumn").Value = that string value

You would insert that value into the document using a field such as
{ DOCVARIABLE mycolumn }

There would also typically be some code to deal with the situation where
the Word Document Variable does not already exist.

So...you probably need to identify where that code is and modify it so
that it sets up/maintains a Word Document Variable called "mycolumn".

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

On 07/10/2009 18:28, Paul wrote:
Hello
I have inherited a Word document template (.dot) that contains docvariable
fields in it that are populated from a VB-interface/Access database. I am
told that the application/DB push the data to this template, unlike a mail
merge (I believe).

My question is that I would like to add a new docvariable field and am able
to. However, after creating it, the field is displayed with the error
stating, "Error! Document variable not defined."

I am wondering how this field is associated with a specific field in the
database? The existing fields in the template all have past values in them.

Paul


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
paul paul is offline
external usenet poster
 
Posts: 249
Default docvariable, template (.dot)

Thanks Peter, I thought that might be the case. I just wanted to make sure I
couldn't do anything with it myself without a VB developer.


"Peter Jamieson" wrote:

A DOCVARIABLE /field/ gets its value from a Word Document Variable,
which would typically be created and populated by a bit of VBA code.

For example, there may be some Access VBA code which
a. opens the template, or a document based on the template
b. uses some code like

objDoc.Variables("the variable name").Value = some string value
obtained from the relevant table/field in Access

It is quite possible that "the variable name" would be the same as the
Access column name, e.g. if you had a column in Access caled "mycolumn",
you might have

objDoc.Variables("mycolumn").Value = that string value

You would insert that value into the document using a field such as
{ DOCVARIABLE mycolumn }

There would also typically be some code to deal with the situation where
the Word Document Variable does not already exist.

So...you probably need to identify where that code is and modify it so
that it sets up/maintains a Word Document Variable called "mycolumn".

Peter Jamieson

http://tips.pjmsn.me.uk
Visit Londinium at http://www.ralphwatson.tv

On 07/10/2009 18:28, Paul wrote:
Hello
I have inherited a Word document template (.dot) that contains docvariable
fields in it that are populated from a VB-interface/Access database. I am
told that the application/DB push the data to this template, unlike a mail
merge (I believe).

My question is that I would like to add a new docvariable field and am able
to. However, after creating it, the field is displayed with the error
stating, "Error! Document variable not defined."

I am wondering how this field is associated with a specific field in the
database? The existing fields in the template all have past values in them.

Paul



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
docvariable fields - force negative numbers to disred OR paren - h Lisa Microsoft Word Help 2 March 21st 08 07:28 AM
DocVariable fields adjacent to end of cell marks display wrongly John Nurick Tables 3 January 18th 07 12:51 PM
Use DocVariable field to initiative numbering? Tom Mailmerge 25 December 12th 06 02:15 PM
Help with FIELD CODES: DOCVARIABLE!!! Wendy D Microsoft Word Help 2 August 16th 05 08:32 PM
Cannot printing DocVariable Field lubo Microsoft Word Help 1 April 9th 05 07:00 AM


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