Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Genealogy Seminar    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Custom Formatting in Forms
Tzvi Possick 
     
4 years ago
This is my UNION query.

SELECT MonthBirthdayListQ2.Code, Person, BDay
FROM MonthBirthdayListQ2


UNION SELECT MonthAnniversaryListQ2.Code, Couple, WDay
FROM MonthAnniversaryListQ2


I use concat to create person & couple from the database. It lists each person with their birthday and then it lists the couples joint names with their anniversary. Now I am at the report stage. How would I set the anniversary as bold, but birthdays as regular font? And MaidenName in Italic, in a report?

Harry Houdini.......................June 15/1938
Marry Houdini.......................September 12, 1942
Harry & Marry (Smith) Houdini.......July 28, 1962
Kevin Yip  @Reply  
     
4 years ago
Change your second part of the union query to this:

    UNION SELECT MonthAnniversaryListQ2.Code, Couple, "<b>" & WDay & "</b>" AS WDay_f

<b> and </b> are rich text formatting codes for bold, and "WDay_f" denotes "Wedding Day formatted".

In report design, create an *unbound* textbox (named Text1, for instance), and set its "Text Format" on the property sheet to "Rich Text".  

Then go to the report detail's Format event procedure in VBA, and assign the value of WDay_f to Text1:

     Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
         Me!Text1 = Me!WDay_f
     End Sub

And voila, all wedding days will be printed in bold, because of the bold format codes in them.

For the above VBA to work, you need to add WDay_f as an invisible textbox on the report.

To make the maiden name italic, you use a similar method, and the format codes are <i> and </i>.  But the maiden name needs to be in a separate field.  I don't know how the names are stored in your tables, but you need to make that happen in order to use this method.

Let me know if you need some screenshots, as this is admittedly quite an involved process.

Tzvi Possick OP  @Reply  
     
4 years ago
Thank you Kevin. I posted in the fee based forum for assistance for my CUSTOM REPORTS, but received no response yet. I thought that I can do it myself, with a few pieces of advice in this forum, but there are really more parts involved that I mentioned above and this is a one time project for me. I could not find tutorials within CLZ or online that helps me enough, like I was able to do with the database itself. Am I allowed to ask for fee based help here? As much as I appreciate free advice, I think that whoever helps me deserves more than a simple thank you.
Tzvi Possick OP  @Reply  
     
4 years ago

Tzvi Possick OP  @Reply  
     
4 years ago
This is a sample of one of the 3 reports that I am looking to create.
Kevin Yip  @Reply  
     
4 years ago
I'm retired, and unfortunately I'm not ready (yet) to take on paid assignments.  You may want to post again at AccessDev.Net and add "2nd request" in the subject.  I don't want to leave you empty-handed, so I made a little sample DB with a report that uses the trick I mentioned in my previous post.  You may download my DB (only 500K in size) at this public link:

https://drive.google.com/file/d/14lVoaIifc5rxiZWAQtSLiPQ-sMpPzDT0/view?usp=sharing

See my screenshots below as well.  You need a "rich text" textbox in your report in order to show any type of text formatting like bold and italic.  My union query shows the trick I use: format codes like <b> and <i> are added to the query results.  My VBA code only has 4 lines, but then it only does the one thing you mentioned.  You said you had other objectives in mind.  Hopefully you'll find someone here (or elsewhere) who can achieve all your goals.

You may continue to ask me questions in this thread, of course.  I can give you advice, but I can't give you a professionally done and fully supported product right now.
Kevin Yip  @Reply  
     
4 years ago

Tzvi Possick OP  @Reply  
     
4 years ago
Wonderful. I will play with this and thanks for all your help.
Tzvi Possick OP  @Reply  
     
4 years ago
I changed my tables from short text to long text, so that I have the option to switch them to Rich Text, but now my concat strings don't work properly. How would I fix this?

FullName: [FirstName] & (" """+[NickName]+"""") & (" ("+[MaidenName]+")") & (" "+[LastName]) & (" ("+[ParentsName]+")")

now gives me this

Yehudis "" (Weiss) Roth () instead of Yehudis (Weiss) Roth - no nickname or no parents name

and this

Rivka "" () Weiss (Isaac &amp; Miriam) instead of Rivka Weiss (Isaac & Miriam) - no nickname or maiden name
Kevin Yip  @Reply  
     
4 years ago
You need to check if any of those names are null, and only include parentheses and quotes if they are not null.  For instance:

    IIf(IsNull([NickName]), " ", " "" & [NickName] & """")

If you are unfamiliar with the IIf() function, Richard has videos and courses on it.
Tzvi Possick OP  @Reply  
     
4 years ago
I've watched all the videos but I don't see how to fix this issue. I am still getting "" and () by all records. What am I doing wrong?

Other: IIf(IsNull([NickName]),""," """ & [NickName] & """") & IIf(IsNull([MaidenName]),""," (" & [MaidenName] & ")")

I am getting
"" ()
"" (Weiss)
"Bobby" ()
"Howie" (Roberts) - This one is correct because it has both names.
Kevin Yip  @Reply  
     
4 years ago
Your names may not be null, but empty strings, or have only spaces.  In this case, you need to check for nulls, empty strings, and spaces all at once with the Len() and Trim() functions.  E.g.:

    IIf(Len(Trim([NickName] & "")) = 0, " ", " "" & [NickName] & """")

Trim() removes beginning and trailing spaces in a string.  And Len() returns the length of a string.  Null is not a string, so you need to concatenate any potential null value with an empty string ("") to make it a string.  So Len(Trim(s & "")) will always return zero if s is null, empty, or has only spaces.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Genealogy Seminar.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 2:55:02 PM. PLT: 0s