Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Sam Sam is offline
external usenet poster
 
Posts: 68
Default HELP: Error! No document variable supplied

Hi All,

I have created a button in access form that exports certain details from the
form to a word template. But when exporting textfields that has no values (on
access form) displays an error:
Error! No document variable supplied.

Here is my code to resolve this issue but it's not working.

With doc
..variables("Name").Value = Nz((Name.Value), "")
..variables("Address").Value = Nz(Address.Value, "")
..variables("City").Value = !Nz(Me.City.Value, "")

..Fields.Update
End With

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default HELP: Error! No document variable supplied

Generally speaking, you are better off setting document variable values
to " " rather than "", because "" deletes the variable object. If you
are using DOCVARIABLE fields to insert the values and you always want to
avoid inserting a single space you can - in theory - use

{ IF "{ DOCVARIABLE myvar }" " " "{ DOCVARIABLE myvar }" }

or if you prefer to reduce the number of quotes you can probably get
away with

{ IF { DOCVARIABLE myvar } " " { DOCVARIABLE myvar } }

There are oddities in Word's handling of docvariable fields, and they
are not apparent at first because when the document variable collection
is empty, a field like

{ DOCVARIABLE myvar }

will display nothing, whereas if the document variable myvar does not
exist, but there is at least one other document variable in the
collection, the same field will display

"Error! No document variable supplied."

(In fact I think it may even be slightly more complicated than that)

Peter Jamieson

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

On 22/10/2009 20:13, sam wrote:
Hi All,

I have created a button in access form that exports certain details from the
form to a word template. But when exporting textfields that has no values (on
access form) displays an error:
Error! No document variable supplied.

Here is my code to resolve this issue but it's not working.

With doc
.variables("Name").Value = Nz((Name.Value), "")
.variables("Address").Value = Nz(Address.Value, "")
.variables("City").Value = !Nz(Me.City.Value, "")

.Fields.Update
End With

Thanks in advance

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
need template delivery note goods supplied Kenny the welder Page Layout 0 March 9th 08 12:35 PM
what is check the temp enviroment variable error Larry B Microsoft Word Help 0 November 30th 06 01:51 AM
what is check enviroment variable error Larry B Microsoft Word Help 0 November 30th 06 01:48 AM
run time error 91 object variable or with block variable not set GJ Microsoft Word Help 0 August 5th 05 02:43 PM
run time error 91 Object Variable or With Block Variable not set champcf Microsoft Word Help 3 January 6th 05 01:17 PM


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