Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / February 2007

Tip: Looking for answers? Try searching our database.

docvariable when empty gives error - how to stop error text in doc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
justagrunt - 21 Feb 2007 03:17 GMT
Hi,
Using docvariables in a mail merge.
Using a record set to isolate the data from and access table.
   Address1 = Nz(![Address1])
   Address2 = Nz(![Address2])
   Address3 = Nz(![Address3])
   Address4 = Nz(![Address4])
   Address5 = Nz(![Address5])
   Address6 = Nz(![Address6])

then

   Set docvar = WordDoc.Variables

   docvar.Item("Address1").Value = Address1
   docvar.Item("Address2").Value = Address2
   docvar.Item("Address3").Value = Address3
   docvar.Item("Address4").Value = Address4
   docvar.Item("Address5").Value = Address5
   docvar.Item("Address6").Value = Address6

problem lies if any of the fields has no information i get  error - no
document variable supplied showing on the document.
Thought I'd  cleared it with the Nz function.
How do I get a round the problem of a docvariable having the possibility of
no information as the feild in access has no information.
Say no information for address feilds 5 and 6.

Signature

Regards
Bill

Doug Robbins - Word MVP - 21 Feb 2007 04:52 GMT
The Access built-in Nz() function provides for two arguements.

Use Address1 = Nz(![Address1], " ")

so that Address1 will contain just a space if the corresponding field is
empty.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi,
> Using docvariables in a mail merge.
[quoted text clipped - 24 lines]
> no information as the feild in access has no information.
> Say no information for address feilds 5 and 6.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.