Below is my code. I am trying to select only the records meeting the two criteria and then clone the data to a datagrid. I need helo joining the two select statements. I have try "and"...but it does not work.. it says data mismatch.
there are two text box for user input for the select"
polookup1
itemnolookup1
then a command button for click to execute the following:
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=J:\purchaseorders.mdb;Persist Security Info=False"
Set CN = New ADODB.Connection
CN.Open strConn
stcnQL1 = "SELECT * FROM tpurchaseorders where pono=" & "'" + Polookup1.Text + "'" And "SELECT * FROM tpurchaseorders where itemno=" & "'" + Itemnolookup1.Text + "'"
Set RS1 = New ADODB.Recordset
With rsclone
.ActiveConnection = CN
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Properties("IRowsetIdentity") = True
.Open stcnQL1, , , , adCmdText
End With
Set Adodc1.Recordset = RS1
Set DataGrid1.DataSource = Adodc1.Recordset
Set rsclone = Adodc1.Recordset.Clone
Please help me joined the two select statements
thanks in advance
there are two text box for user input for the select"
polookup1
itemnolookup1
then a command button for click to execute the following:
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=J:\purchaseorders.mdb;Persist Security Info=False"
Set CN = New ADODB.Connection
CN.Open strConn
stcnQL1 = "SELECT * FROM tpurchaseorders where pono=" & "'" + Polookup1.Text + "'" And "SELECT * FROM tpurchaseorders where itemno=" & "'" + Itemnolookup1.Text + "'"
Set RS1 = New ADODB.Recordset
With rsclone
.ActiveConnection = CN
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Properties("IRowsetIdentity") = True
.Open stcnQL1, , , , adCmdText
End With
Set Adodc1.Recordset = RS1
Set DataGrid1.DataSource = Adodc1.Recordset
Set rsclone = Adodc1.Recordset.Clone
Please help me joined the two select statements
thanks in advance