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

How to add a string to a field in a query.

Status
Not open for further replies.

Milleniumlegend

IS-IT--Management
Dec 16, 2003
135
I am running a query and would like to add a String to one of the fields.

The field is Address and I would like to append the string to the address so that it contains say xyz. How can I do that.

Many thanks
 
If you are using SQL within Access then you can use the concatenation operator "&" to join a field with text
e.g. select my_fld & ' my_text ' from my_tbl

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Frederico's answer works in program code or in SQL View and a similar technique will work in the Design View.

Drop the Address into the Field grid as usual then click on it and change that cell to read:

[tt]Address & "xyz"[/tt]

You'll see that Access changes this to read:

[tt]Expr1:[Address] & "xyz"[/tt]

"Expr1" is the name that Access will give to this column - it can't call it "Address" any more because it's not the address. You can change "Expr1" to give the column a more meaningful name.

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top