On 23 Nov 2005 11:08:57 -0800,
le*********@natpro.com wrote:
I have 3 tables (office97)
tblQuote
quoteNbr
tblDetails ( quote : 1 <-> M: quoteDetails)
quoteNbr
detailLine
product
value
tblComments ( quote : 1 <-> M: quoteComments)
quoteNbr
commentLine
comment
I can use vba to create a details text file for a quote, that is used
as a word mail merge data source
the word document shows
quote : 123
line product value
1 abc 100.00
2 xyz 200.00
and I can create a comments text file to create a word document like
quote : 123
line comment
1 it is nice today
2 it will rain tomorrow
3 it will be nice on Saturday
but how do I create a data source and a word template to combine the
two, as in
quote : 123
line product value
1 abc 100.00
2 xyz 200.00
line comment
1 it is nice today
2 it will rain tomorrow
3 it will be nice on Saturday
do I add a field to my text file "D"etail or "C"omment and use
IF..THEN.. ELSE ?
does my text file need five lines for this quote (2 detail, + 3
comment) ?
It is probable that a Word newsgroup will have better advice than I
can offer.
You can't really do this in one document in Word, as Word has no
method that I'm aware of to "move to a next detail record" that you
can condition. So, unless your quotes have a specific number of
detail lines, you can't have Word know when to start switching to
comment lines.
What you can do is run a mail merge on one portion of your document
(either the comments or the other) and then run a mail merge on the
other portion, using the already created output as a subdocument for
your second mail merge.
As intimated above, you can do this in one Word document if you always
have a specific number of detail lines.
I guess another way to do it would be to have Access print a line with
the appropriate number of detail lines in it and have selectively use
a subdocument that has the right number of detail lines based on that
input. For example, say that the text file has:
3
DetailLine1
DetailLine2
DetailLine3
6
CommentLine1
CommentLine2
CommentLine3
CommentLine4
CommentLine5
CommentLine6
You could set up a Word document that read the first value (3) and
then selectively inserted a word document that had 3 detail lines to
be merged in. Then it would read the second value (6) and then insert
a word document that had 6 comment lines to be merged in.
This would be a hecka lot of files and indicates to me that there has
to be a better way.
What about using Access to control Word so that you can just insert
the appropriate information directly into your Word document and not
mess with any of this?
mike
mike