Hi, when I call rs.open I get the error: Too few parameters, Expected 1.
VB Code:
Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim sql As String Dim cboText As String Set cn = New ADODB.Connection cn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _ "Dbq=h:\project\db1.mdb;" & _ "Uid=admin;" & _ "Pwd=" cn.Open Set rs = New ADODB.Recordset cboText = cboClass.Text sql = "SELECT StudentName FROM tblStudents WHERE " & _ "StudentClass1 = " & Quotes(cboText) & " OR " & _ "StudentClass2 = " & Quotes(cboText) & " OR " & _ "StudentClass3 = " & Quotes(cboText) & " OR " & _ "StudentClass4 = " & Quotes(cboText) & " OR " & _ "StudentClass5 = " & Quotes(cboText) & " OR " & _ "StudentClass6 = " & Quotes(cboText) & " OR " & _ "StudentClass7 = " & Quotes(cboText) & " OR " & _ "StudentClass8 = " & Quotes(cboText) & " OR " & _ "StudentClass9 = " & Quotes(cboText) & " OR " & _ "StudentClass10 = " & Quotes(cboText) MsgBox sql rs.Open sql, cn2 rs.MoveFirst Do While Not rs.EOF
Any ideas?




Reply With Quote