Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine 2 text Fields in a query

Status
Not open for further replies.

crystalfun

Programmer
Feb 8, 2001
39
0
0
US
This should be an easy one. I have a query with a text field called "Comp" and a second text field called "Dept".

I want to combine these two fields in a query so that I get the results of "Comp Dept". How do I do this to see the results in my query.

Thanks.
 
Select Field1 + ' ' + Field2
From Table

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Hi,

You can also have if you want to have a coma in between.
SELECT [field1] & ", " & [field2] AS Expr1
FROM Tablename;

If you want to take into consideration null values in either field:
SELECT IIf(IsNull([tablename].[fieldname1]),[tablename].[fieldname2],[tablename].[fieldname1] & IIf(IsNull([fieldname2]),"",", " & [fieldname2])) AS Expr1
FROM Tablename;

HTH,

M-.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top