On 23 Dec 2004 01:09:21 -0800,
sv***@yahoo.com wrote:
Dear All,
I have lately strugled more and more with Access, what started as a
simple database has brought me to the fundaments of Access.
You might want to look up the word "fundament" or perhaps that is what you
meant <g>.
I need to transfer fields from various tables to a word-document to
make a decent report (transferring a report from access to word means a
lot of loss on lay out, which I find a clear showcase of microsoft's
socalled software quality).
Well, it is a limitation of Access. Eveything has its limits though.
I can not use queries to combine the tables and a send one to word
(with mailmerge). I have one main table (A) ...and 8 subtables (B-H).
Each record in A has a varying number of records in B-H. Sofar, I have
not been able to make one table for a record in A that combines all the
relevant records in the table B-H
Now I am trying to do it with VBA. I wonder whether it is better to
open a doc file from out of Access or whether it is better to make a
VBA module in Word itself. For both approaches I see some advantages
and disadvantages but since I am rather new to VBA I would not be
surprised to encounter major obstacles later on that I can not foresee
rightnow.
For example, i need to make tables in the word-doc. Is it better to do
this from out of Access (wirth VBA) or directly in Word (with VBA), or
maybe it does not make a difference at all?
I would be glad if people could send some of there VBA codes in which a
Word-doc is opened from out of Acces and where fields from multiple
tables are send to Word. Preferable even VBA code in which tables are
constructed in the Word-Doc
I don't have any code to send you at the moment, but I seem to recall that
on-line examples are plentiful, and should not be hard to find with Google.
Regarding your question of whether it would be easier to do in Word or in
Access, the hardest parts of the problem all center asound the MS Word API, so
you may want to write the code in MS Word, though once it's written, you may
find it desirable to convert that to automation code that runs form Access,
and that's not hard to do.
Another option is to save your template Word document in XML format, and use
Access and the MSXML library to transform the XML to produce your output
document. The learning curve is much steaper this way, but when you factor in
debugging time MS Word API quirks, VB reference versioning, etc., the XML way
might win by a hair. Another advantage of XML is that MS Word need not even
be installed on the machine that generates the document. You could translate
the code into a VB COM library called from an ASP application running on a
server later on, and it would still work.