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).
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:
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? :)
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Beginner 9.