Arthur Fuller
artful at rogers.com
Sun Jun 12 15:46:12 CDT 2005
Assume a report Arthur_rpt, which is scoped by the currently selected PK. I want to create an HTML file from said rpt and save it to a name derived from the PK (i.e. 12345-T1-20050612). What is the command to to do this? I have read the Access help and a few related docs and still cannot deduce what I am to do, nor where I am to do it. The exact scenario: a) I have a Word template AF001.dot. b) from this, in Access and using the Word object model, I create a new Word doc and populate various bookmarks with data. c) What remains to do is fill in three tables in the created doc with rows derived from the principal or ancillary queries. The template has the table already created, with its headers etc. Now supposing that the query returns 8 rows; I need to add 8 rows to the table to contain the retrieved data. On my reading, mail-merge was not designed to do this. It assumes instead that each row corresponds to one document. Let me reiterate to make my requirements as clear as possible. a) I have an Access report which behaves correctly (i.e. retrieves the data desired and places it in the places desired. b) I have a Word template containing a bunch of boilerplate and places for N tables., which correspond exactly to the subforms in the Access report aforementioned. c) Assume N tables that must be embedded in the Word doc. Assume also that any of these may contain no rows -- in which case the table(s) must be remdered invisible. I have been looking at the mailmerge docs, the Word objiect-model docs, and so on, and I still don;t have a clear handle on this. I know exactly what I want to do, and will try to express iti clearly below. I iust can't see the way to do it. Access PK = 12345 SubTable 1 SubTable 2 SubTable 1.1 Most of the Word doc is boilerplate (but even then. conditionals are at play). Here and there in the DOT file are bookmarks, which I populate without difficulty. The issues I have arise with the embedded tables. For simplicity's sake. assume one template containing two tables. each of whose length varies from doc to doc. Table 1 must be formatted in this way (3 cols) while Table 2 must be formatted in that way (4 cols). The kludge that works is sickening as judged from my peers' pov... so don't waste our bandwidth bitching about that. What I do at the moment (permission granted to laugh) is gen an HTML file of the requisite tables then import that into the actual document. It sucks I admit but it works. for now. I need this all to become a one-button no-brainder for the users to use. Recipe" 1 Word Template with both bookmarks (simple) and slots for tables 2. Access tabular outputs in whatever form will work best 3. Drop the tables into the doc and allow the user to save it to a suggeted name. Table A might have one row; Table B might have 3 rows for every row in T1. I can make this happen manually (i.e. intervening with keystrokes) but I need to automate it. Any suggestions? TIA, Arthur