S
Stephen Glynn
I've used the code at described in 'How to send the current record to
Word 2000 with automation'
(http://support.microsoft.com/Default.aspx?kbid=210271}
to do what it says on the can. It works by opening a Word document
containing bookmarks, setting the value of Word bookmarks to those of
fields in the Access form, saving the results as a new document and
closing the old one unsaved, thus retaining it for future use.
I far prefer this to the alternative technique of opening a new document
from a template that uses an Access query as the datasource since it's
a lot faster. However, there's one drawback.
If you merge a Word document, Word takes out any blank lines in the
address and adjusts the spacing accordingly. This doesn't, though,
work with bookmarks, so if I've got fields in my query (and bookmarks
ready to receive their contents) AddressLine1, AddressLine2 and City,
and the particular record doesn't have an entry for AddressLine2, the
resulting Word document has an unsightly gap between the first (and
only, in this case) line of the address and the city.
Is there a way to address this problem at the Access end, possibly by
having something in the code to delete the bookmark AddressLine2 and the
carriage return if MyAccessQuery.AddressLine2 is null? How would I do
this?
Steve
Word 2000 with automation'
(http://support.microsoft.com/Default.aspx?kbid=210271}
to do what it says on the can. It works by opening a Word document
containing bookmarks, setting the value of Word bookmarks to those of
fields in the Access form, saving the results as a new document and
closing the old one unsaved, thus retaining it for future use.
I far prefer this to the alternative technique of opening a new document
from a template that uses an Access query as the datasource since it's
a lot faster. However, there's one drawback.
If you merge a Word document, Word takes out any blank lines in the
address and adjusts the spacing accordingly. This doesn't, though,
work with bookmarks, so if I've got fields in my query (and bookmarks
ready to receive their contents) AddressLine1, AddressLine2 and City,
and the particular record doesn't have an entry for AddressLine2, the
resulting Word document has an unsightly gap between the first (and
only, in this case) line of the address and the city.
Is there a way to address this problem at the Access end, possibly by
having something in the code to delete the bookmark AddressLine2 and the
carriage return if MyAccessQuery.AddressLine2 is null? How would I do
this?
Steve