PDA

Click to See Complete Forum and Search --> : SQL query syntax


billwagnon
Dec 12th, 1999, 01:22 AM
what are some good resources for learning SQL query syntax? I can do simple ones, but the following problem has perplexed me.

I want to create or filter a recordset based on a combobox selection, but the combobox selection is made up of FirstName and LastName, which are separate fields in the database. How can I say "WHERE FirstName & LastName = 'cboName.text'"? Is this possible?

Dec 12th, 1999, 02:22 AM
Try
WHERE FirstName = cboFname.text
AND LastName = cboLname.text

Gerald
Dec 12th, 1999, 05:36 AM
If you are using Visual Basic, the MSDN CD is a good place to look for SQL syntax--although it's a little light on examples. Here is a link to an online reference that may be helpful: http://torresoft.netmegs.com/

To address your immediate need, try...


Dim sSQL as String

sSQL = "SELECT Firstname & ' ' & Lastname AS Thename FROM YourTable WHERE Thename = '" & cboName.Text & "'"


Gerald M.


[This message has been edited by Gerald (edited 12-13-1999).]

billwagnon
Dec 12th, 1999, 09:31 AM
Thanks! I didn't know you could combine fields like that in SQL.