Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
magicdds magicdds is offline
external usenet poster
 
Posts: 15
Default lineing up data from access in a column in word

I have data in Access that might look as follows for a patient:

Discrepancy = Response1 LF Response2 LF Response3
Crossbite = Response4 LF Response5
Overbite =
Other Problems = Response6 LF Response7 LF Response8

where LF is a "line feed"


In my word document I am doing the following:

If {Mergefield{Discrepancy} "" "{Advance \x15}Arch Discrepancy: {Advance
\x200} Mergefield{Discrepancy}" ""}
If {Mergefield{Crossbite} "" "{Advance \x15}Crossbite: {Advance \x200}
Mergefield{Crossbite}" ""}
If {Mergefield{Overbite} "" "{Advance \x15}Overbite: {Advance \x200}
Mergefield{Overbite}" ""}
If {Mergefield{Other Problems} "" "{Advance \x15}Other Problems: {Advance
\x200} Mergefield{Other Problems}" ""}


I would like the printout in Word to look as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

Instead, what prints is as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

I tryed to use a table to print the results but this presented with two
problems:
1) a row was created in the table for OVERBITE, which was blank since
overbite had no responses
2) After each row in the table, there was an extra blank line that I could
not eliminate.This spread out the information on the paper over too much
space and did not look very professional.
So the table route did not work.

I tried to figure out how to use a hanging indent to get things to print out
correctly, but I couldn't figure out how to apply the hanging indent only to
the responses.

Can anyone help with how to set up this form letter.

Thanks,
Mark


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default lineing up data from access in a column in word

Do you actually have just these 4 fields, or is this just an illustration?

If it is just 4, there are 16 possible table layouts starting from "no
table" (all the fields are blank) to a four-row table (all the fields
are non-blank). In that case it is just about practical to have 16 IF
fields, each of which inserts the table you need. If one or more of the
fields is always non-blank, the numer of possible combinations you have
to deal with is obviously reduced. You can make it slightly easier to do
the IF field by doing something like

{ IF { MERGEFIELD Discrepancy } = "" { SET D "Y" } { SET D "X" }
}{ IF { MERGEFIELD Crossbite } = "" { SET C "Y" } { SET C "X" }
}{ IF { MERGEFIELD Overbite } = "" { SET O "Y" } { SET O "X" }
}{ IF { MERGEFIELD "Other Problems" } = "" { SET P "Y" } { SET P "X" }
}{ SET DCOP "{ REF D }{ REF C }{ REF O }{ REF P }"
}{ IF "{ REF DCOP }" = "XXXX" "" ""
}{ IF "{ REF DCOP }" = "XXXY" "put a 1-row table with the 'Other
problems' field here'" ""
}{ IF "{ REF DCOP }" = "XXYX" "put a 1-row table with the 'Overbite
field here'" ""
}{ IF "{ REF DCOP }" = "XXYY" "put a 2-row table with the 'Overbite'
and 'Other problems' fields here'" ""
}

and so on.

If you have 5 or more fields, things obviously become much more
difficult. There are other possible approaches, but let's see if the
above can work for you first.


Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
I have data in Access that might look as follows for a patient:

Discrepancy = Response1 LF Response2 LF Response3
Crossbite = Response4 LF Response5
Overbite =
Other Problems = Response6 LF Response7 LF Response8

where LF is a "line feed"


In my word document I am doing the following:

If {Mergefield{Discrepancy} "" "{Advance \x15}Arch Discrepancy: {Advance
\x200} Mergefield{Discrepancy}" ""}
If {Mergefield{Crossbite} "" "{Advance \x15}Crossbite: {Advance \x200}
Mergefield{Crossbite}" ""}
If {Mergefield{Overbite} "" "{Advance \x15}Overbite: {Advance \x200}
Mergefield{Overbite}" ""}
If {Mergefield{Other Problems} "" "{Advance \x15}Other Problems: {Advance
\x200} Mergefield{Other Problems}" ""}


I would like the printout in Word to look as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

Instead, what prints is as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

I tryed to use a table to print the results but this presented with two
problems:
1) a row was created in the table for OVERBITE, which was blank since
overbite had no responses
2) After each row in the table, there was an extra blank line that I could
not eliminate.This spread out the information on the paper over too much
space and did not look very professional.
So the table route did not work.

I tried to figure out how to use a hanging indent to get things to print out
correctly, but I couldn't figure out how to apply the hanging indent only to
the responses.

Can anyone help with how to set up this form letter.

Thanks,
Mark


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
magicdds magicdds is offline
external usenet poster
 
Posts: 15
Default lineing up data from access in a column in word

This was just an illustration. There are actually 25 fields to deal with.
This would present with too many possible tables to create. The other problem
with tables is that the printout has an extra blank line inbetween each row.
You said that there were other possible approaches. Do any of the other
approaches not involve the use of tables?

Thanks for your help.
Mark



"Peter Jamieson" wrote:

Do you actually have just these 4 fields, or is this just an illustration?

If it is just 4, there are 16 possible table layouts starting from "no
table" (all the fields are blank) to a four-row table (all the fields
are non-blank). In that case it is just about practical to have 16 IF
fields, each of which inserts the table you need. If one or more of the
fields is always non-blank, the numer of possible combinations you have
to deal with is obviously reduced. You can make it slightly easier to do
the IF field by doing something like

{ IF { MERGEFIELD Discrepancy } = "" { SET D "Y" } { SET D "X" }
}{ IF { MERGEFIELD Crossbite } = "" { SET C "Y" } { SET C "X" }
}{ IF { MERGEFIELD Overbite } = "" { SET O "Y" } { SET O "X" }
}{ IF { MERGEFIELD "Other Problems" } = "" { SET P "Y" } { SET P "X" }
}{ SET DCOP "{ REF D }{ REF C }{ REF O }{ REF P }"
}{ IF "{ REF DCOP }" = "XXXX" "" ""
}{ IF "{ REF DCOP }" = "XXXY" "put a 1-row table with the 'Other
problems' field here'" ""
}{ IF "{ REF DCOP }" = "XXYX" "put a 1-row table with the 'Overbite
field here'" ""
}{ IF "{ REF DCOP }" = "XXYY" "put a 2-row table with the 'Overbite'
and 'Other problems' fields here'" ""
}

and so on.

If you have 5 or more fields, things obviously become much more
difficult. There are other possible approaches, but let's see if the
above can work for you first.


Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
I have data in Access that might look as follows for a patient:

Discrepancy = Response1 LF Response2 LF Response3
Crossbite = Response4 LF Response5
Overbite =
Other Problems = Response6 LF Response7 LF Response8

where LF is a "line feed"


In my word document I am doing the following:

If {Mergefield{Discrepancy} "" "{Advance \x15}Arch Discrepancy: {Advance
\x200} Mergefield{Discrepancy}" ""}
If {Mergefield{Crossbite} "" "{Advance \x15}Crossbite: {Advance \x200}
Mergefield{Crossbite}" ""}
If {Mergefield{Overbite} "" "{Advance \x15}Overbite: {Advance \x200}
Mergefield{Overbite}" ""}
If {Mergefield{Other Problems} "" "{Advance \x15}Other Problems: {Advance
\x200} Mergefield{Other Problems}" ""}


I would like the printout in Word to look as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

Instead, what prints is as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

I tryed to use a table to print the results but this presented with two
problems:
1) a row was created in the table for OVERBITE, which was blank since
overbite had no responses
2) After each row in the table, there was an extra blank line that I could
not eliminate.This spread out the information on the paper over too much
space and did not look very professional.
So the table route did not work.

I tried to figure out how to use a hanging indent to get things to print out
correctly, but I couldn't figure out how to apply the hanging indent only to
the responses.

Can anyone help with how to set up this form letter.

Thanks,
Mark



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP on news.microsoft.com Doug Robbins - Word MVP on news.microsoft.com is offline
external usenet poster
 
Posts: 407
Default lineing up data from access in a column in word

The alternative that I would consider first would be to use an Access report
rather than mailmerge.

Only after I had convinced myself that an Access report was not possible, I
would then use visual basic to iterate through the data in Access and create
a document with the required layout in Word, formatting each of the
paragraphs with a hanging indent and using the Replace() function to replace
the LF with TABLF

Another approach could be after executing the merge to a new document, use a
macro that makes use of the EditFind ability of Word to look for each of
the headings and then apply the necessary formatting.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"magicdds" wrote in message
...
This was just an illustration. There are actually 25 fields to deal with.
This would present with too many possible tables to create. The other
problem
with tables is that the printout has an extra blank line inbetween each
row.
You said that there were other possible approaches. Do any of the other
approaches not involve the use of tables?

Thanks for your help.
Mark



"Peter Jamieson" wrote:

Do you actually have just these 4 fields, or is this just an
illustration?

If it is just 4, there are 16 possible table layouts starting from "no
table" (all the fields are blank) to a four-row table (all the fields
are non-blank). In that case it is just about practical to have 16 IF
fields, each of which inserts the table you need. If one or more of the
fields is always non-blank, the numer of possible combinations you have
to deal with is obviously reduced. You can make it slightly easier to do
the IF field by doing something like

{ IF { MERGEFIELD Discrepancy } = "" { SET D "Y" } { SET D "X" }
}{ IF { MERGEFIELD Crossbite } = "" { SET C "Y" } { SET C "X" }
}{ IF { MERGEFIELD Overbite } = "" { SET O "Y" } { SET O "X" }
}{ IF { MERGEFIELD "Other Problems" } = "" { SET P "Y" } { SET P "X" }
}{ SET DCOP "{ REF D }{ REF C }{ REF O }{ REF P }"
}{ IF "{ REF DCOP }" = "XXXX" "" ""
}{ IF "{ REF DCOP }" = "XXXY" "put a 1-row table with the 'Other
problems' field here'" ""
}{ IF "{ REF DCOP }" = "XXYX" "put a 1-row table with the 'Overbite
field here'" ""
}{ IF "{ REF DCOP }" = "XXYY" "put a 2-row table with the 'Overbite'
and 'Other problems' fields here'" ""
}

and so on.

If you have 5 or more fields, things obviously become much more
difficult. There are other possible approaches, but let's see if the
above can work for you first.


Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
I have data in Access that might look as follows for a patient:

Discrepancy = Response1 LF Response2 LF Response3
Crossbite = Response4 LF Response5
Overbite =
Other Problems = Response6 LF Response7 LF Response8

where LF is a "line feed"


In my word document I am doing the following:

If {Mergefield{Discrepancy} "" "{Advance \x15}Arch Discrepancy:
{Advance
\x200} Mergefield{Discrepancy}" ""}
If {Mergefield{Crossbite} "" "{Advance \x15}Crossbite: {Advance
\x200}
Mergefield{Crossbite}" ""}
If {Mergefield{Overbite} "" "{Advance \x15}Overbite: {Advance \x200}
Mergefield{Overbite}" ""}
If {Mergefield{Other Problems} "" "{Advance \x15}Other Problems:
{Advance
\x200} Mergefield{Other Problems}" ""}


I would like the printout in Word to look as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

Instead, what prints is as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

I tryed to use a table to print the results but this presented with two
problems:
1) a row was created in the table for OVERBITE, which was blank since
overbite had no responses
2) After each row in the table, there was an extra blank line that I
could
not eliminate.This spread out the information on the paper over too
much
space and did not look very professional.
So the table route did not work.

I tried to figure out how to use a hanging indent to get things to
print out
correctly, but I couldn't figure out how to apply the hanging indent
only to
the responses.

Can anyone help with how to set up this form letter.

Thanks,
Mark





  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default lineing up data from access in a column in word

You said that there were other possible approaches. Do any of the other
approaches not involve the use of tables?


The main other approaches that I had in mind would involve the creation
of an intermediate data source, but it might not solve the "extra line"
problems you report. I'll have to have a look.

I take it that you considered Doug's suggestions?

Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
This was just an illustration. There are actually 25 fields to deal with.
This would present with too many possible tables to create. The other problem
with tables is that the printout has an extra blank line inbetween each row.
You said that there were other possible approaches. Do any of the other
approaches not involve the use of tables?

Thanks for your help.
Mark



"Peter Jamieson" wrote:

Do you actually have just these 4 fields, or is this just an illustration?

If it is just 4, there are 16 possible table layouts starting from "no
table" (all the fields are blank) to a four-row table (all the fields
are non-blank). In that case it is just about practical to have 16 IF
fields, each of which inserts the table you need. If one or more of the
fields is always non-blank, the numer of possible combinations you have
to deal with is obviously reduced. You can make it slightly easier to do
the IF field by doing something like

{ IF { MERGEFIELD Discrepancy } = "" { SET D "Y" } { SET D "X" }
}{ IF { MERGEFIELD Crossbite } = "" { SET C "Y" } { SET C "X" }
}{ IF { MERGEFIELD Overbite } = "" { SET O "Y" } { SET O "X" }
}{ IF { MERGEFIELD "Other Problems" } = "" { SET P "Y" } { SET P "X" }
}{ SET DCOP "{ REF D }{ REF C }{ REF O }{ REF P }"
}{ IF "{ REF DCOP }" = "XXXX" "" ""
}{ IF "{ REF DCOP }" = "XXXY" "put a 1-row table with the 'Other
problems' field here'" ""
}{ IF "{ REF DCOP }" = "XXYX" "put a 1-row table with the 'Overbite
field here'" ""
}{ IF "{ REF DCOP }" = "XXYY" "put a 2-row table with the 'Overbite'
and 'Other problems' fields here'" ""
}

and so on.

If you have 5 or more fields, things obviously become much more
difficult. There are other possible approaches, but let's see if the
above can work for you first.


Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
I have data in Access that might look as follows for a patient:

Discrepancy = Response1 LF Response2 LF Response3
Crossbite = Response4 LF Response5
Overbite =
Other Problems = Response6 LF Response7 LF Response8

where LF is a "line feed"


In my word document I am doing the following:

If {Mergefield{Discrepancy} "" "{Advance \x15}Arch Discrepancy: {Advance
\x200} Mergefield{Discrepancy}" ""}
If {Mergefield{Crossbite} "" "{Advance \x15}Crossbite: {Advance \x200}
Mergefield{Crossbite}" ""}
If {Mergefield{Overbite} "" "{Advance \x15}Overbite: {Advance \x200}
Mergefield{Overbite}" ""}
If {Mergefield{Other Problems} "" "{Advance \x15}Other Problems: {Advance
\x200} Mergefield{Other Problems}" ""}


I would like the printout in Word to look as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

Instead, what prints is as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

I tryed to use a table to print the results but this presented with two
problems:
1) a row was created in the table for OVERBITE, which was blank since
overbite had no responses
2) After each row in the table, there was an extra blank line that I could
not eliminate.This spread out the information on the paper over too much
space and did not look very professional.
So the table route did not work.

I tried to figure out how to use a hanging indent to get things to print out
correctly, but I couldn't figure out how to apply the hanging indent only to
the responses.

Can anyone help with how to set up this form letter.

Thanks,
Mark




  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default lineing up data from access in a column in word

How about the following:

You clcik the Show/Hide button (the pilcrow or reverse P) to show
formatting characters such as tabs and paragraph marks

You insert the following nested field codes:

{ IF "{ MERGEFIELD Discrepancy }" = "" "" "Discrepancy:tabenter
{ MERGEFIELD Discrepancy }enter
" }

where instead of tab you press the Tab key, and instead of enter you
press the Enter key. You should then see a 3-line IF field with a tab
and paragraph mark at the end of line one, and a paragraph mark at the
end of line two.

Select the first line of the IF field and use Format-Paragraph-Tabs to
set a Left tab of 2in (or 5cm, say). This is just as an example.

Select the paragraph mark at the end of the first line and use
Format-Font to set it to Hidden

Select the second line of the IF field and use format-Paragraph to set
the left indent to 2in/5cm

Merge to a new document. You will probably see something like

Discrepancy
Line 1
Line 2
Line 3

Now click the Show/Hide button while the new document is visible. With
any luck you will see this change to something like

Discrepancy Line 1
Line 2
Line 3

If so, duplicate that first IF field and change the names so you have e.g.

{ IF "{ MERGEFIELD Discrepancy }" = "" "" "Discrepancy:tabenter
{ MERGEFIELD Discrepancy }enter
" }{ IF "{ MERGEFIELD Crossbite }" = "" "" "Crossbite:tabenter
{ MERGEFIELD Crossbite }enter
" }{ IF "{ MERGEFIELD Overbite }" = "" "" "Overbite:tabenter
{ MERGEFIELD Overbite }enter
" }

and so on. Try the merge again.

I have only tried this with small data volumes on Word XP but it does
seem to work. I suspect anything else is going to be considerably harder.



Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
This was just an illustration. There are actually 25 fields to deal with.
This would present with too many possible tables to create. The other problem
with tables is that the printout has an extra blank line inbetween each row.
You said that there were other possible approaches. Do any of the other
approaches not involve the use of tables?

Thanks for your help.
Mark



"Peter Jamieson" wrote:

Do you actually have just these 4 fields, or is this just an illustration?

If it is just 4, there are 16 possible table layouts starting from "no
table" (all the fields are blank) to a four-row table (all the fields
are non-blank). In that case it is just about practical to have 16 IF
fields, each of which inserts the table you need. If one or more of the
fields is always non-blank, the numer of possible combinations you have
to deal with is obviously reduced. You can make it slightly easier to do
the IF field by doing something like

{ IF { MERGEFIELD Discrepancy } = "" { SET D "Y" } { SET D "X" }
}{ IF { MERGEFIELD Crossbite } = "" { SET C "Y" } { SET C "X" }
}{ IF { MERGEFIELD Overbite } = "" { SET O "Y" } { SET O "X" }
}{ IF { MERGEFIELD "Other Problems" } = "" { SET P "Y" } { SET P "X" }
}{ SET DCOP "{ REF D }{ REF C }{ REF O }{ REF P }"
}{ IF "{ REF DCOP }" = "XXXX" "" ""
}{ IF "{ REF DCOP }" = "XXXY" "put a 1-row table with the 'Other
problems' field here'" ""
}{ IF "{ REF DCOP }" = "XXYX" "put a 1-row table with the 'Overbite
field here'" ""
}{ IF "{ REF DCOP }" = "XXYY" "put a 2-row table with the 'Overbite'
and 'Other problems' fields here'" ""
}

and so on.

If you have 5 or more fields, things obviously become much more
difficult. There are other possible approaches, but let's see if the
above can work for you first.


Peter Jamieson

http://tips.pjmsn.me.uk

magicdds wrote:
I have data in Access that might look as follows for a patient:

Discrepancy = Response1 LF Response2 LF Response3
Crossbite = Response4 LF Response5
Overbite =
Other Problems = Response6 LF Response7 LF Response8

where LF is a "line feed"


In my word document I am doing the following:

If {Mergefield{Discrepancy} "" "{Advance \x15}Arch Discrepancy: {Advance
\x200} Mergefield{Discrepancy}" ""}
If {Mergefield{Crossbite} "" "{Advance \x15}Crossbite: {Advance \x200}
Mergefield{Crossbite}" ""}
If {Mergefield{Overbite} "" "{Advance \x15}Overbite: {Advance \x200}
Mergefield{Overbite}" ""}
If {Mergefield{Other Problems} "" "{Advance \x15}Other Problems: {Advance
\x200} Mergefield{Other Problems}" ""}


I would like the printout in Word to look as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

Instead, what prints is as follows:

Discrepancy: Response1
Response2
Response3
Crossbite: Response4
Response5
Other Problems: Response6
Response7
Response8

I tryed to use a table to print the results but this presented with two
problems:
1) a row was created in the table for OVERBITE, which was blank since
overbite had no responses
2) After each row in the table, there was an extra blank line that I could
not eliminate.This spread out the information on the paper over too much
space and did not look very professional.
So the table route did not work.

I tried to figure out how to use a hanging indent to get things to print out
correctly, but I couldn't figure out how to apply the hanging indent only to
the responses.

Can anyone help with how to set up this form letter.

Thanks,
Mark


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
When I open my data source (xlsx), I cannot see all my data column David Griesel[_2_] Mailmerge 1 February 5th 09 07:56 AM
Lineing up merged data properly on printout magicdds Mailmerge 3 January 18th 09 05:33 AM
Access a row/column in DATABASE [email protected] Mailmerge 2 August 24th 06 09:35 AM
Word does imports just the first column of a CSV data set AlexanderGross Mailmerge 2 April 27th 06 04:56 PM
Converting WORD to ACCESS with field titles in first column? Jeri Mailmerge 2 May 23rd 05 07:50 PM


All times are GMT +1. The time now is 02:37 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"