SSQL Statement

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
 
G

Guest

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
 
G

Guest

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
 
P

Pieter Wijnen

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top