SSQL Statement

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to populate a list box with a combination of two fields based on
the selection in anoter list box. Here's the part of the code I am struggling
with:

Select Case Me![Selectionlist]
Case "FullName": sSQL = "SELECT [FirstName] & [LastName] AS FullName
FROM tblPeople ORDER BY [FirstName] ;"
More case.........more stuff and End select.

This returns FirstNameLastName. I am looking for FirstNameSPACELastName.
Placing &" " & between the FirstName and Lastname:

.......SELECT [FirstName] &" " [LastName]......seemed like a logical option
but it does not work. Any help with this one? Thanks
 
Hi Tom,
......SELECT [FirstName] &" " [LastName]......seemed like a logical option
but it does not work.

I believe you are missing one ampersand. Try this:

SELECT [FirstName] & " " & [LastName] AS FullName


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

Tom Ventouris said:
I am trying to populate a list box with a combination of two fields based on
the selection in anoter list box. Here's the part of the code I am struggling
with:

Select Case Me![Selectionlist]
Case "FullName": sSQL = "SELECT [FirstName] & [LastName] AS FullName
FROM tblPeople ORDER BY [FirstName] ;"
More case.........more stuff and End select.

This returns FirstNameLastName. I am looking for FirstNameSPACELastName.
Placing &" " & between the FirstName and Lastname:

......SELECT [FirstName] &" " [LastName]......seemed like a logical option
but it does not work. Any help with this one? Thanks
 
Thanks, Tom. The missing ambersome was a typo in my post. &" "& returns the
message"Compile Error. Expected End of statement".

Don't ask, but I tried &' '&........this works! Note the single quote.
I am too happy to look for an answer.

Tom Wickerath said:
Hi Tom,
......SELECT [FirstName] &" " [LastName]......seemed like a logical option
but it does not work.

I believe you are missing one ampersand. Try this:

SELECT [FirstName] & " " & [LastName] AS FullName


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

Tom Ventouris said:
I am trying to populate a list box with a combination of two fields based on
the selection in anoter list box. Here's the part of the code I am struggling
with:

Select Case Me![Selectionlist]
Case "FullName": sSQL = "SELECT [FirstName] & [LastName] AS FullName
FROM tblPeople ORDER BY [FirstName] ;"
More case.........more stuff and End select.

This returns FirstNameLastName. I am looking for FirstNameSPACELastName.
Placing &" " & between the FirstName and Lastname:

......SELECT [FirstName] &" " [LastName]......seemed like a logical option
but it does not work. Any help with this one? Thanks
 
Try
"SELECT [FirstName] & ' ' & [LastName]......"

Pieter

Tom Ventouris said:
Thanks, Tom. The missing ambersome was a typo in my post. &" "& returns
the
message"Compile Error. Expected End of statement".

Don't ask, but I tried &' '&........this works! Note the single quote.
I am too happy to look for an answer.

Tom Wickerath said:
Hi Tom,
......SELECT [FirstName] &" " [LastName]......seemed like a logical
option
but it does not work.

I believe you are missing one ampersand. Try this:

SELECT [FirstName] & " " & [LastName] AS FullName


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

Tom Ventouris said:
I am trying to populate a list box with a combination of two fields
based on
the selection in anoter list box. Here's the part of the code I am
struggling
with:

Select Case Me![Selectionlist]
Case "FullName": sSQL = "SELECT [FirstName] & [LastName] AS
FullName
FROM tblPeople ORDER BY [FirstName] ;"
More case.........more stuff and End select.

This returns FirstNameLastName. I am looking for
FirstNameSPACELastName.
Placing &" " & between the FirstName and Lastname:

......SELECT [FirstName] &" " [LastName]......seemed like a logical
option
but it does not work. Any help with this one? Thanks
 
Thanks, done. Check my previous post.

Pieter Wijnen said:
Try
"SELECT [FirstName] & ' ' & [LastName]......"

Pieter

Tom Ventouris said:
Thanks, Tom. The missing ambersome was a typo in my post. &" "& returns
the
message"Compile Error. Expected End of statement".

Don't ask, but I tried &' '&........this works! Note the single quote.
I am too happy to look for an answer.

Tom Wickerath said:
Hi Tom,

......SELECT [FirstName] &" " [LastName]......seemed like a logical
option
but it does not work.

I believe you are missing one ampersand. Try this:

SELECT [FirstName] & " " & [LastName] AS FullName


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I am trying to populate a list box with a combination of two fields
based on
the selection in anoter list box. Here's the part of the code I am
struggling
with:

Select Case Me![Selectionlist]
Case "FullName": sSQL = "SELECT [FirstName] & [LastName] AS
FullName
FROM tblPeople ORDER BY [FirstName] ;"
More case.........more stuff and End select.

This returns FirstNameLastName. I am looking for
FirstNameSPACELastName.
Placing &" " & between the FirstName and Lastname:

......SELECT [FirstName] &" " [LastName]......seemed like a logical
option
but it does not work. Any help with this one? Thanks
 
Back
Top