Link to home
Start Free TrialLog in
Avatar of tpigielski
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
Avatar of pdebaets
pdebaets
Flag of United States of America image

If you are in SQL view try

last_name & ", " & first_name as [name]

however, I would recommend NOT using a reserved word as a field name. Try "fullname" instead of "name".
Avatar of tpigielski
tpigielski

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
ASKER CERTIFIED SOLUTION
Avatar of pdebaets
pdebaets
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Gustav Brock
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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial