tpigielski
asked on
Combining table fields within a query
I have an access 2007 application that has a person table, with last_name, first_name attributes. I would like to build a query where I can combine last_name and first_name, and represent the combined fields as one field "name". I have tried the following:
name:last_name & ", " & first_name
but I get syntax errors from SQL.
Is there a way to do this?
Thanks in advance for your help.
Tom
name:last_name & ", " & first_name
but I get syntax errors from SQL.
Is there a way to do this?
Thanks in advance for your help.
Tom
ASKER
Poor choice of identifiers on my part. "name" is not what I am using, but something else. My query is much more complicated than this (multiple tables). What I really need to know is whether or not I can do this kind of an operation from a query?
Thanks..Tom
Thanks..Tom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Problem could be that some fields are empty:
full_name: IIf(last_name+first_name Is Null, Nz(last_name & first_name, "Unknown"),last_name & ", " & first_name)
/gustav
full_name: IIf(last_name+first_name Is Null, Nz(last_name & first_name, "Unknown"),last_name & ", " & first_name)
/gustav
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
last_name & ", " & first_name as [name]
however, I would recommend NOT using a reserved word as a field name. Try "fullname" instead of "name".