View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
justagrunt justagrunt is offline
external usenet poster
 
Posts: 7
Default docvariable when empty gives error - how to stop error text in doc

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.



--
Regards
Bill