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

SQL statement

Status
Not open for further replies.

TTThio

Programmer
May 3, 2001
185
US
Hi again,

I don't understand what's wrong, need help with this:

button_click() - in frm1

strSelect = frm1.txt1
strSQL = "Select * from query1 where [name] = " & strSelect
or strSQL = "Select * from query1 where [name]= " & strSelect&""

set rs = db.openrecordset (strSQL)
msgbox rs.recordcount

None of the two strSQL above returns result. I forgot which one even returns error "too few parameter, expected 1"

Yet, if change the Where criteria [name] = 'text', it does return record.

Can anyone help me?

Thanks,
Tin Tin
 
My mistake, I got it:

strSQL = "Select * from query1 where [name]= "' & strSelect&"'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top