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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine Fields

Status
Not open for further replies.

tpearo

Technical User
Apr 24, 2000
124
US
Is there a way to combine fields from a query to read as one on a report? I have a query that has "Last Name" and "First Name" fields. I want on the report to just show the two fields combined. ex. instead of Jones, Bob - I would like it to show Bob Jones

 
To concatenate two fields into a single field in your result set, open your query in design mode. Next enter your field names in the query window separated by the & symbol.

-L
 
plus the " " for the space!!

FirstName & " " & LastName

Leslie
 
Or just to be anal about the whole thing
Code:
Trim$(FirstName) & IIF (Len(Trim$(FirstName))>0, " ", "" ) & LastName
Just so that "Smith" (with no first name) doesn't end up as " Smith" with the leading blank.
 
These fields are comming from a table called HR_Employee_tbl. When I just put the FirstName & " " & LastName in an open grid in the query box I get some type of syntax error.
 
You need to decide if the field name is FirstName or First Name. If you have an issue with a query, please post the SQL View so someone can help.

Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top