P
PieterLinden
For sure the wrong NG, but anyway...
I'm working on creating a report in Word that works essentially the
same way as the Report Writer code in Access Developer's Handbook.
The main difference between my "process" and the one in the book is
that I want to pass and append multiple recordsets to a Word table,
and am wondering what is the best way to do it.
Here's what I have right now...
A table of Questions,
CREATE TABLE StudyQuestions(
StudyID char(6) NOT NULL,
QuestionID Long NOT NULL,
QuestionText varchar(255) NOT NULL,
AnswerQueryObject VARCHAR2(255),
Sequence INTEGER UNIQUE)
sorry for the bastard SQL, but it's easier than explaining the
structure any other way...
The plan, which works great so far, is this:
1. Study Manager (not me) enters the questions for which queries must
be written against the database.
2. I write the queries and assign them to the question the query
answers.
3. Once the questions are "answered" (assigned a query), I want to do
something like...
For each question/query pair (record in tblStudyQuestion)
a. Convert the query result to a delimited string (use an ADO
recordset and GetString)
b. append the result to a Word document based on a template.
c. insert a carriage return/blank line
Next Question
Then, when I have all of the result sets in Word, convert the whole
mess to a table in one fell swoop, and then I can add other text using
Word VBA stuff. The layout of the Word document is always something
like this:
<Study Name>
<other details from Access... could just use bookmarks for these,
which is easy>
<table>
<tr>
<td>Section Name</td>
<td>Question Text</td>
for each record in the recordset...
<td>Recordset data</td>
</tr>
<tr></tr> (skip a line in the table.)
next record
then, when report has been generated, add the headers and footers and
all those goodies. It's just easier to select all the contents of the
document and convert all that mess to a table all at once.
Has anybody else ever done this before? Is this a sound plan, or do I
need to get out more and talk to normal people instead of just myself?
Thanks,
Pieter
I'm working on creating a report in Word that works essentially the
same way as the Report Writer code in Access Developer's Handbook.
The main difference between my "process" and the one in the book is
that I want to pass and append multiple recordsets to a Word table,
and am wondering what is the best way to do it.
Here's what I have right now...
A table of Questions,
CREATE TABLE StudyQuestions(
StudyID char(6) NOT NULL,
QuestionID Long NOT NULL,
QuestionText varchar(255) NOT NULL,
AnswerQueryObject VARCHAR2(255),
Sequence INTEGER UNIQUE)
sorry for the bastard SQL, but it's easier than explaining the
structure any other way...
The plan, which works great so far, is this:
1. Study Manager (not me) enters the questions for which queries must
be written against the database.
2. I write the queries and assign them to the question the query
answers.
3. Once the questions are "answered" (assigned a query), I want to do
something like...
For each question/query pair (record in tblStudyQuestion)
a. Convert the query result to a delimited string (use an ADO
recordset and GetString)
b. append the result to a Word document based on a template.
c. insert a carriage return/blank line
Next Question
Then, when I have all of the result sets in Word, convert the whole
mess to a table in one fell swoop, and then I can add other text using
Word VBA stuff. The layout of the Word document is always something
like this:
<Study Name>
<other details from Access... could just use bookmarks for these,
which is easy>
<table>
<tr>
<td>Section Name</td>
<td>Question Text</td>
for each record in the recordset...
<td>Recordset data</td>
</tr>
<tr></tr> (skip a line in the table.)
next record
then, when report has been generated, add the headers and footers and
all those goodies. It's just easier to select all the contents of the
document and convert all that mess to a table all at once.
Has anybody else ever done this before? Is this a sound plan, or do I
need to get out more and talk to normal people instead of just myself?
Thanks,
Pieter