Concatenation Not Working

lhooker

Registered User.
Local time
Today, 12:36
Joined
Dec 30, 2005
Messages
431
Why is no 'Actual_Name' given when no 'Middle_Name' is provided in a select query ? Below is the syntax of the statement.

Actual_Name: [First_Name]+" "+[Middle_Name]+" "+[Last_Name]

:banghead:
 
What is your complete SQL statement?
What is your actual results?
What is your expected results?
 
Try this instead:

Code:
Actual_Name: [First_Name] & IIf(Nz([Middle_Name],"")<>""," " & [Middle_Name] & " "," ") & [Last_Name]

Notice I've replaced + separator with &
Also modified the handling of spaces around the middle name so you don't get two spaces if no middle name exists
 
Because it propagate the null when you use +, instead:

Actual_Name: ([First_Name] + " ") & ( [Middle_Name]) + " ") & [Last_Name]
 
BigHappyDaddy/Ridders/Arnelgp/Pat Hartman,

Thanks to all ! ! ! I used Arnelgp's solution.
 

Users who are viewing this thread

Back
Top Bottom