two database columns to one combo box

D

dh

I have a connect string for loading a combo box that I want to modify. Now
it ends up being one column from my access database, feeds a combo box on a
Custom Outlook form.
Connect string:
strSQL = "SELECT [DienCodes],[DetailedApplication]" & " " & "AS FinalCodes"
& " " & "from Codes " & "WHERE [CodeID] =" & CatID & " " & "AND" & " " &
"[CountryCode] =" & CountryCode & " " & "ORDER BY [DienCodes];"

My two columns from the database are DienCodes and DetailedApplication



I want to take two columns and concatenate them into the one combo box.
I am having trouble figuring this out.
Any assistance would be appreciated!
Thanks
DH
 
J

John Vinson

My two columns from the database are DienCodes and DetailedApplication
I want to take two columns and concatenate them into the one combo box.
I am having trouble figuring this out.

You're concatenating a lot of little pieces that could be concatenated
as big chunks!

Try

strSQL = "SELECT [DienCodes] & [DetailedApplication] AS FinalCodes" _
& " from Codes WHERE [CodeID] =" & CatID & " AND [CountryCode] =" _
& CountryCode & " ORDER BY [DienCodes];"

The purpose of concatenating is just to get a valid SQL string - you
don't need to treat each word and blank as a separate substring.
 
D

dh

Thanks I will give it a try!
DH

John Vinson said:
My two columns from the database are DienCodes and DetailedApplication
I want to take two columns and concatenate them into the one combo box.
I am having trouble figuring this out.

You're concatenating a lot of little pieces that could be concatenated
as big chunks!

Try

strSQL = "SELECT [DienCodes] & [DetailedApplication] AS FinalCodes" _
& " from Codes WHERE [CodeID] =" & CatID & " AND [CountryCode] =" _
& CountryCode & " ORDER BY [DienCodes];"

The purpose of concatenating is just to get a valid SQL string - you
don't need to treat each word and blank as a separate substring.
 

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