Nearing Christmas again and trying to solve one more problem. Each child served has one letter merged about that child. For teens, people want to know if the child already has things like watch, tapeplayer or if they have pierced ears— these fields are not applicable to preschoolers so when I have used “if ..then ” to state “This child has(or does not have) a watch; I get odd reactions to letters about 2 yr old even though I have this in a box saying it relates to teens. I think I will change to a text field (in Access) and have “has” does not have” and Not applicable as the possibilities and simply have a straight merge. What I would prefer, would be to illiminate the information on letters for young kids. Any suggestions?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
printing if then fields in a mail merge from acces (2000)
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » printing if then fields in a mail merge from acces (2000)
- This topic has 16 replies, 2 voices, and was last updated 21 years, 9 months ago.
AuthorTopicWScenterdirector
AskWoody LoungerSeptember 16, 2003 at 10:47 am #393633Viewing 1 reply threadAuthorReplies-
WBell
AskWoody_MVPSeptember 16, 2003 at 1:03 pm #715416There are a couple of ways to approach this – one is to do separate letters for teens and younger children. The other is to use an IF … Then … Else … field in your word merge document, and put different text depending on whether they are a teen or preschooler. The second approach is a bit more complicated but lets you work with a single merge letter. I gues there is another way as well. You could construct the text of the Has/DoesNotHave section of your letter as a text string in a query and just merge that result to a single field in your merge document.
-
WScenterdirector
AskWoody LoungerSeptember 16, 2003 at 4:16 pm #715546Dear Wendell– yes, I was using if then else– and I can do that–but as I mentioned–it still leaves me with childrens letters saying that they do not have a watch– would rather not have that on a 2 year old letter. Dividing teen and childrens letters would have some merit–but , I want the families printed at the same time so they can be kept together (it seems to work best when group sponsors have the whole family.) (I am sorry that I did not mention that in the original post) What I want, is to have those four answers not appear at all on the kids letters. I may just have to go with a three response answer and have one of the possibilities be Not Applicable. I will have to make this decision in the next two days as there are already many forms to enter. Thanks for your response.
-
WBell
AskWoody_MVPSeptember 16, 2003 at 4:35 pm #715556Sorry – I should have been more specific. The trick is to embed the individual IF…THENs into another IF…THEN which uses a field code to display those fields if a teen is involved, and not display them otherwise. It’s a bit tricky to say, and you have to be sure all field codes are visible before you do it, but we’ve done very much the same thing where some people had to meet certain criteria and get one message, and another set get a different and more complex set based on their situation. Hope this make sense. If not, try attaching your Word merge document, and I’ll try to mock up what I have in mind.
-
WScenterdirector
AskWoody LoungerSeptember 16, 2003 at 8:23 pm #715696that sounds like EXACTLY what I wanted– do not know how to embed one “if then else” into another–any help you can offer would be MUCH appreciated– right now I have a yes no field on each of the four questions– would like it to not print if the child was over a certain age (say 10) and print “this child Does(or this child does not) have a watch. I am off to teach a class and will return about 10 tonight (it is 5 something now) there is a DOB field to identify the ages.
-
WBell
AskWoody_MVP -
WScenterdirector
AskWoody LoungerSeptember 17, 2003 at 10:40 pm #716334 -
WScenterdirector
AskWoody LoungerSeptember 17, 2003 at 11:13 pm #716350maybe I explained poorly– in these particular 4 fields : watch—pierced ears—tape player– and CD player — the database allows yes or no (a check box) currently I have an if then else statement in the merge letter that says “This child does not have a watch” or “This child does own a watch” depending on the info in the database about that child. What I would like is for there to be NO information printed at all if the child was under ten– or it could say “this is a preteen; no information available ” or information not provided for younger children…. and I could accomplish the same by having Not Applicable as a text field along with Yes and NO for each question. Then the letter would not need an if then field– it could simply say Child has a watch (yes) or (no) or (Not Applicable) Was just hoping for the first option.
-
WScenterdirector
AskWoody LoungerSeptember 17, 2003 at 11:13 pm #716351maybe I explained poorly– in these particular 4 fields : watch—pierced ears—tape player– and CD player — the database allows yes or no (a check box) currently I have an if then else statement in the merge letter that says “This child does not have a watch” or “This child does own a watch” depending on the info in the database about that child. What I would like is for there to be NO information printed at all if the child was under ten– or it could say “this is a preteen; no information available ” or information not provided for younger children…. and I could accomplish the same by having Not Applicable as a text field along with Yes and NO for each question. Then the letter would not need an if then field– it could simply say Child has a watch (yes) or (no) or (Not Applicable) Was just hoping for the first option.
-
WBell
AskWoody_MVPSeptember 17, 2003 at 11:25 pm #716356Actually there isn’t any code (at least VBA) in what I did, and if you can’t get it to expand, then you can’t really see what’s going on. Let me try to give you a process to do it in a word document:
- Open a blank Word document and insert an IF field in the document that looks something like:
{ IF DOB < 12/31/2000 "Text String If True" "Text String If False" } - Now turn the document into a Word Merge document so you can insert merge fields
- Now replace the words Text String If True (but not the quotes) with the IF statements you have been using to display whether or not a given teen had a watch or not, a tape player or not, and so on
- Finally replace the words Text String If False (again leave the quotes) with whatever you want to display for pre-teens.
The field codes I ended up with looked something like:
{ IF { MERGEFIELD DOB * MERGEFORMAT } < "12/31/2000" "{ IF {MERGEFIELD HASWATCH * MERGEFORMAT } "has watch" "does not have watch
" } { IF {MERGEFIELD HASTPLAYER * MERGEFORMAT } "has tape player" "does not have tape player"" "This child is a preteen" }
You could actually do a series of embedded IF statements for each article, but one of the tricky aspects is to not leave blank lines, and the approach I suggested can do it, though it gets pretty messy trying to make sure you put returns where you need them. Also note that you can’t simply paste in the statements from this post – Word needs to insert them as fields. Hope this makes it a little clearer, but on the other hand - Open a blank Word document and insert an IF field in the document that looks something like:
-
WBell
AskWoody_MVPSeptember 17, 2003 at 11:25 pm #716357Actually there isn’t any code (at least VBA) in what I did, and if you can’t get it to expand, then you can’t really see what’s going on. Let me try to give you a process to do it in a word document:
- Open a blank Word document and insert an IF field in the document that looks something like:
{ IF DOB < 12/31/2000 "Text String If True" "Text String If False" } - Now turn the document into a Word Merge document so you can insert merge fields
- Now replace the words Text String If True (but not the quotes) with the IF statements you have been using to display whether or not a given teen had a watch or not, a tape player or not, and so on
- Finally replace the words Text String If False (again leave the quotes) with whatever you want to display for pre-teens.
The field codes I ended up with looked something like:
{ IF { MERGEFIELD DOB * MERGEFORMAT } < "12/31/2000" "{ IF {MERGEFIELD HASWATCH * MERGEFORMAT } "has watch" "does not have watch
" } { IF {MERGEFIELD HASTPLAYER * MERGEFORMAT } "has tape player" "does not have tape player"" "This child is a preteen" }
You could actually do a series of embedded IF statements for each article, but one of the tricky aspects is to not leave blank lines, and the approach I suggested can do it, though it gets pretty messy trying to make sure you put returns where you need them. Also note that you can’t simply paste in the statements from this post – Word needs to insert them as fields. Hope this makes it a little clearer, but on the other hand - Open a blank Word document and insert an IF field in the document that looks something like:
-
WScenterdirector
AskWoody LoungerSeptember 17, 2003 at 10:40 pm #716335 -
WBell
AskWoody_MVP
-
-
WScenterdirector
AskWoody LoungerSeptember 16, 2003 at 8:23 pm #715697that sounds like EXACTLY what I wanted– do not know how to embed one “if then else” into another–any help you can offer would be MUCH appreciated– right now I have a yes no field on each of the four questions– would like it to not print if the child was over a certain age (say 10) and print “this child Does(or this child does not) have a watch. I am off to teach a class and will return about 10 tonight (it is 5 something now) there is a DOB field to identify the ages.
-
-
WBell
AskWoody_MVPSeptember 16, 2003 at 4:35 pm #715557Sorry – I should have been more specific. The trick is to embed the individual IF…THENs into another IF…THEN which uses a field code to display those fields if a teen is involved, and not display them otherwise. It’s a bit tricky to say, and you have to be sure all field codes are visible before you do it, but we’ve done very much the same thing where some people had to meet certain criteria and get one message, and another set get a different and more complex set based on their situation. Hope this make sense. If not, try attaching your Word merge document, and I’ll try to mock up what I have in mind.
-
-
WScenterdirector
AskWoody LoungerSeptember 16, 2003 at 4:16 pm #715547Dear Wendell– yes, I was using if then else– and I can do that–but as I mentioned–it still leaves me with childrens letters saying that they do not have a watch– would rather not have that on a 2 year old letter. Dividing teen and childrens letters would have some merit–but , I want the families printed at the same time so they can be kept together (it seems to work best when group sponsors have the whole family.) (I am sorry that I did not mention that in the original post) What I want, is to have those four answers not appear at all on the kids letters. I may just have to go with a three response answer and have one of the possibilities be Not Applicable. I will have to make this decision in the next two days as there are already many forms to enter. Thanks for your response.
-
-
WBell
AskWoody_MVPSeptember 16, 2003 at 1:03 pm #715417There are a couple of ways to approach this – one is to do separate letters for teens and younger children. The other is to use an IF … Then … Else … field in your word merge document, and put different text depending on whether they are a teen or preschooler. The second approach is a bit more complicated but lets you work with a single merge letter. I gues there is another way as well. You could construct the text of the Has/DoesNotHave section of your letter as a text string in a query and just merge that result to a single field in your merge document.
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Have Copilot there but not taking over the screen in Word
by
CWBillow
5 hours, 37 minutes ago -
Windows 11 blocks Chrome 137.0.7151.68, 137.0.7151.69
by
Alex5723
1 day, 3 hours ago -
Are Macs immune?
by
Susan Bradley
1 day, 1 hour ago -
HP Envy and the Function keys
by
CWBillow
11 hours, 43 minutes ago -
Microsoft : Removal of unwanted drivers from Windows Update
by
Alex5723
1 day, 15 hours ago -
MacOS 26 beta 1 dropped support for Firewire 400/800
by
Alex5723
1 day, 15 hours ago -
Unable to update to version 22h2
by
04om
6 hours, 5 minutes ago -
Windows 11 Insider Preview Build 26100.4482 (24H2) released to Release Preview
by
joep517
1 day, 23 hours ago -
Windows 11 Insider Preview build 27881 released to Canary
by
joep517
1 day, 23 hours ago -
Very Quarrelsome Taskbar!
by
CWBillow
1 day, 8 hours ago -
Move OneNote Notebook OFF OneDrive and make it local
by
CWBillow
2 days, 12 hours ago -
Microsoft 365 to block file access via legacy auth protocols by default
by
Alex5723
2 days ago -
Is your battery draining?
by
Susan Bradley
12 hours, 2 minutes ago -
The 16-billion-record data breach that no one’s ever heard of
by
Alex5723
5 hours, 39 minutes ago -
Weasel Words Rule Too Many Data Breach Notifications
by
Nibbled To Death By Ducks
2 days, 15 hours ago -
Windows Command Prompt and Powershell will not open as Administrator
by
Gordski
1 hour, 57 minutes ago -
Intel Management Engine (Intel ME) Security Issue
by
PL1
2 days ago -
Old Geek Forced to Update. Buy a Win 11 PC? Yikes! How do I cope?
by
RonE22
1 day, 16 hours ago -
National scam day
by
Susan Bradley
23 hours, 14 minutes ago -
macOS Tahoe 26 the end of the road for Intel Macs, OCLP, Hackintosh
by
Alex5723
1 day, 19 hours ago -
Cyberattack on some Washington Post journalists’ email accounts
by
Bob99
3 days, 16 hours ago -
Tools to support internet discussions
by
Kathy Stevens
2 days, 5 hours ago -
How get Group Policy to allow specific Driver to download?
by
Tex265
3 days, 8 hours ago -
AI is good sometimes
by
Susan Bradley
4 days ago -
Mozilla quietly tests Perplexity AI as a New Firefox Search Option
by
Alex5723
3 days, 14 hours ago -
Perplexity Pro free for 12 mos for Samsung Galaxy phones
by
Patricia Grace
5 days ago -
June KB5060842 update broke DHCP server service
by
Alex5723
4 days, 22 hours ago -
AMD Ryzen™ Chipset Driver Release Notes 7.06.02.123
by
Alex5723
5 days, 2 hours ago -
Excessive security alerts
by
WSSebastian42
3 days, 17 hours ago -
* CrystalDiskMark may shorten SSD/USB Memory life
by
Alex5723
5 days, 12 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.