K
Keith G Hicks
My VBA code in MS Access inserts data from a query into bookmarks in a dot
file. I have a function that takes any # of address lines and stacks them
up. If there are 3 address fields for a customer in the table the function
takes into account that any one or more of them could be empty. For example:
AddressLine1 = "123 Main"
AddressLine2 = NULL
AddressLine3 = "Suite 1"
City = "Berkley"
State = "CA"
ZipCode = "91234"
The above gets concateneated like this:
CustAddress = AddressLine1 & Chr(13) & Chr(10) & AddressLine3 & Chr(13) &
Chr(10) & City & ", " & State & " " & ZipCode
The code in the function ignores AddressLine2 because it's empty. So the
resultant address in the query would be this:
123 Main
Suite 1
Berkley, CA 91234
and not this:
123 Main
Suite 1
Berkley, CA 91234
This works fine in MS Access. But when I post it to the word dot file as
follows:
..Item("CustAddress").Result = Nz(rs!CustAddress, "")
I end up with this on my document:
123 Main | | Suite 1 | | Berkley, CA 91234
where the 4 pipe characters are actually the little squares that appear when
a character is not in the font set.
I do not want to post the address lines separately to the template. I have
several other similar situations. What do I need to do to get this to work
correctly?
Thanks,
Keith
file. I have a function that takes any # of address lines and stacks them
up. If there are 3 address fields for a customer in the table the function
takes into account that any one or more of them could be empty. For example:
AddressLine1 = "123 Main"
AddressLine2 = NULL
AddressLine3 = "Suite 1"
City = "Berkley"
State = "CA"
ZipCode = "91234"
The above gets concateneated like this:
CustAddress = AddressLine1 & Chr(13) & Chr(10) & AddressLine3 & Chr(13) &
Chr(10) & City & ", " & State & " " & ZipCode
The code in the function ignores AddressLine2 because it's empty. So the
resultant address in the query would be this:
123 Main
Suite 1
Berkley, CA 91234
and not this:
123 Main
Suite 1
Berkley, CA 91234
This works fine in MS Access. But when I post it to the word dot file as
follows:
..Item("CustAddress").Result = Nz(rs!CustAddress, "")
I end up with this on my document:
123 Main | | Suite 1 | | Berkley, CA 91234
where the 4 pipe characters are actually the little squares that appear when
a character is not in the font set.
I do not want to post the address lines separately to the template. I have
several other similar situations. What do I need to do to get this to work
correctly?
Thanks,
Keith