Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
docvariable when empty gives error - how to stop error text in doc
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. -- 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 "justagrunt" wrote in message ... 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Visual basic runtime error 5216, there is a printer error | Microsoft Word Help | |||
Word 2003 - when closing receive 'Runtime Error 91' error messages | Microsoft Word Help | |||
how do I stop a runtime error | Microsoft Word Help | |||
Stop error message - "Compile Error in hidden module appearing" | Microsoft Word Help | |||
I get "subscript out of range" error message. How do I stop this? | New Users |