473,418 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

mail merge with multiple detail tables

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) ?

Nov 23 '05 #1
4 5431
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
Nov 24 '05 #2
thanks for your ideas... it has me thinking more about this
as to having Access create a Word document, I thought of that, but
doesn't that get messy when trying to use bookmarks for text
positioning ?

I wonder if word document A can be a mail merge of the 'comments'
and word document B be can be a mail merge of the 'product detail' + an
imbedded object containing word document A ? that's a good idea you
gave me ... I'll try it out

Mike Preston wrote:
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


Nov 24 '05 #3
On 24 Nov 2005 14:11:14 -0800, le*********@natpro.com wrote:
thanks for your ideas... it has me thinking more about this
as to having Access create a Word document, I thought of that, but
doesn't that get messy when trying to use bookmarks for text
positioning ?
I think you will find it the easiest approach. Try it. I think you
will like it.
I wonder if word document A can be a mail merge of the 'comments'
and word document B be can be a mail merge of the 'product detail' + an
imbedded object containing word document A ? that's a good idea you
gave me ... I'll try it out
I'd try the above, first.

mike

Mike Preston wrote:
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


Nov 25 '05 #4
This seems like it should be done on a report itself. Why use Word?
You can use conditioning and so on.

Nov 25 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: campwes | last post by:
Hey, all. I'm trying to develop a C# app that creates Word 2003 mail merge documents with an Oracle 9i database as the datasource. I used the following as an example of how I can start out: ...
1
by: Morris | last post by:
Does anyone know whether it is possible to effect a mail merge to MSWord using VBScript in an asp file? I know it is possible to produce a doc file and force a download using ...
3
by: Traci | last post by:
I need to do a mail merge letter from my database. The letter will be addressed to small companies and in the body of the letter I need to list employees of the company. There will be from 1 to 15...
8
by: dd_bdlm | last post by:
Hi I wonder if anyone can help? I have looked through prevous posts and cant find any answers that fit what I need to do. For reference I am using Access 97 and Word 97. I want to be able to...
3
by: cdelarte | last post by:
I would like to be able to mail merge records from multiple mysql tables using a simple template, preferably via a command line script. MSWord mail merge via ODBC will not work for me as it only...
6
by: crealesmith | last post by:
Firstly, I have no problem with mail merging to Word, VB code for that works perfectly. On one mail merge I need to merge 15 fields of data that are from 3 seperate records. The 3 records are all...
1
by: mbigelow | last post by:
I'm trying to create an e-mail statement that pulls data from two tables....one table is simply the Student information (e-mail, name, phone etc) and the other table is a Transaction table that can...
7
by: giladp1 | last post by:
I found Albert Kallal's great "Super easy Word Merge" code in his site at: http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html Thanks Albert so much for sharing this. I am looking...
1
by: kirkus84 | last post by:
I am currently trying to do a multiple record mail merge through a query via a command button on a form. The query basically displays customers who have said yes to privacy. The user inputs a date...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.