Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Beginner 9    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Null String Plus FullName Trick
Richard W 
    
12 years ago
Great course and very helpful.  However, I want to build a FullName with a MiddleName, but some people don't have middle names or Initials.  I get two spaces when I add the MiddleName field and it is blank.  Is there a way to "trim" out those spaces?  I thought zero length might work, but alas . . .


Reply from Richard Rost:

There's a little trick that I teach in my SQL Seminar that if you use the + sign instead of & it will automatically turn a NULL+" " into just a NULL (because if you add NULL to anything, it's NULL).

For example, if you have:

FN,MI,LN
Joe,A,Smith
Peter,,Watson

If you say:

FullName: [FirstName] & " " & [MiddleName] & " " & [LastName]

You get:

Joe A Smith
Peter  Watson

Notice the two spaces between Peter and Watson because MiddleName was NULL, but you're still adding spaces around it. Now, if you change the equation to this:

FullName: [FirstName] & (" "+[MiddleName]) & " " & [LastName]

This says to ADD the space to MiddleName using STRING ADDITION, not CONCATENATION. It's slightly different in how it's treated, but the benefit is that if you have a NULL value, that equates to NULL. (Null plus anything is Null). Now you get:

Joe A Smith
Peter Watson

This would probably make a good tip video, huh? :)


This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Beginner 9.
 

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/15/2026 6:41:03 AM. PLT: 0s