Dear experts out there, Please help!!
I have 2 datagrids and a textbox. I want the datagrids to show only records matching the product number that I type into the textbox.
I use a code from another thread below but it did not work.
I put the code behind the productno change event:
The following code is for the first datagrid. I figure if I can get one to work it would be a piece of cake for the second one. the productno.text is unbound.
Dim MyRS As ADODB.Recordset
Dim MySQLString As String
Set MyRS = New ADODB.Recordset
MyRS.CursorLocation = adUseClient
MySQLString = "SELECT * FROM tpurchase WHERE purproductno = productno.text"
MyRS.Open MySQLString, MyConnection, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = MyRS
it is crashing at "MyRS.Open MySQLString, MyConnection, adOpenDynamic, adLockOptimistic" with the follwoing error
"Arguments of the wrong type, are out of acceptable range, or are in conflict with one another"
thanks for your help in advance.
Kay
I have 2 datagrids and a textbox. I want the datagrids to show only records matching the product number that I type into the textbox.
I use a code from another thread below but it did not work.
I put the code behind the productno change event:
The following code is for the first datagrid. I figure if I can get one to work it would be a piece of cake for the second one. the productno.text is unbound.
Dim MyRS As ADODB.Recordset
Dim MySQLString As String
Set MyRS = New ADODB.Recordset
MyRS.CursorLocation = adUseClient
MySQLString = "SELECT * FROM tpurchase WHERE purproductno = productno.text"
MyRS.Open MySQLString, MyConnection, adOpenDynamic, adLockOptimistic
Set DataGrid1.DataSource = MyRS
it is crashing at "MyRS.Open MySQLString, MyConnection, adOpenDynamic, adLockOptimistic" with the follwoing error
"Arguments of the wrong type, are out of acceptable range, or are in conflict with one another"
thanks for your help in advance.
Kay