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!

Concatenate in my Sql. 2

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
Hi,
I cant get a concatenate in my Sql Statement to work.

[surname] & "" & [forename] AS EmployeeName,

I had a coma in between the quote marks and the writing turned red but it still didn't work when I removed it. The full statement is:

strSQL = "SELECT [trust staff].CHP AS Chp, [trust staff].CHPLocation AS Location, [trust staff].PAYNO AS PayNo, [trust staff].[ADDIT PAYNO] AS AdditPayNo, [surname] & "" & [forename] AS EmployeeName [trust staff].START_DATE AS StartDate, [trust staff].[GRADE START], [trust staff].[JD CODE NO] AS JdCodeNo, [trust staff].LEFT AS Leavers, [trust staff].TRANSFER as Transfers " & _
"FROM [trust staff] " & _


Does anyone know how to fix this problem.

 
Code:
strSQL = "SELECT [trust staff].CHP AS Chp, [trust staff].CHPLocation AS Location, [trust staff].PAYNO AS PayNo, [trust staff].[ADDIT PAYNO] AS AdditPayNo, [surname] & "" & [forename] AS EmployeeName[COLOR=red yellow],[/color] [trust staff].START_DATE AS StartDate, [trust staff].[GRADE START], [trust staff].[JD CODE NO] AS JdCodeNo, [trust staff].LEFT AS Leavers, [trust staff].TRANSFER as Transfers " & _
    "FROM [trust staff] " & _

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
something like this ?
strSQL = "SELECT [trust staff].CHP AS Chp, [trust staff].CHPLocation AS Location, [trust staff].PAYNO AS PayNo, [trust staff].[ADDIT PAYNO] AS AdditPayNo, [surname] & [!]', '[/!] & [forename] AS EmployeeName [trust staff].START_DATE AS StartDate, [trust staff].[GRADE START], [trust staff].[JD CODE NO] AS JdCodeNo, [trust staff].LEFT AS Leavers, [trust staff].TRANSFER as Transfers " & _
"FROM [trust staff] " & _

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

Thanks,
You where both right:

strSQL = "SELECT [trust staff].CHP AS Chp, [trust staff].CHPLocation AS Location, [trust staff].PAYNO AS PayNo, [trust staff].[ADDIT PAYNO] AS AdditPayNo, [surname] & ', ' & [forename] AS EmployeeName, [trust staff].START_DATE AS StartDate, [trust staff].[GRADE START], [trust staff].[JD CODE NO] AS JdCodeNo, [trust staff].LEFT AS Leavers, [trust staff].TRANSFER as Transfers " & _
"FROM [trust staff] " & _
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top