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

SQL using ADO Connection

Status
Not open for further replies.

studybum

Programmer
Feb 24, 2001
14
0
0
US
I am trying to sort a database connection depending on what the user selects in a combo box filled from the list property. The syntax I am using is incorrect as it does not see the value the variable is holding but only the variable.

My code is as follows:

spChoice = cboSort.text 'user selection from drop down
spSQL = SELECT * FROM Patient ORDER BY spChoice ASC

Set rsPatient = cnPatient.Execute (spSql,,adCmdText)

In my set statement the spSql remains the exact statement assigned not the selection from the user. What am I missing?

Any help is greatly appreciated.
 
spSQL = "SELECT * FROM Patient ORDER BY " & Chr(34) & spChoice Chr(34) & " ASC "


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top