Hello Everyone
I'm searching a database to find a value in the database and once the value is found, it should update the row corresponding with the productid, which is the PK in which I'm using to search the database.
But I'm getting an error saying wrong number of arguments or invalid property assignment. My code looks like this:
Do While Not rs.EOF
If productid = rs!product_id Then
Set updatedb = New ADODB.Connectio n
updatedb.Open "DSN=waterdb;Pa ssword=andile;U ser ID=eco;Data Source=waterdb"
Set rs1 = New ADODB.Recordset
rs1.Open "Select product_id,qty, stock_date,tran s_type,qtydb from stock", "update stock set product_id=prod uctid", "update stock set qty=qty", "update stock set stock_date=date ", "update stock set trans_type=tran s_type", "update stock set qtydb=qtydb"
With Adodc1
.Recordset.Upda te
.Recordset.Fiel ds("product_id" ) = productid
.Recordset.Fiel ds("qty") = qty
.Recordset.Fiel ds("stock_date" ) = dop
.Recordset.Fiel ds("trans_type" ) = "trans_type "
.Recordset.Fiel ds("qtydb") = qtydb
End With
Else: MsgBox ("invalid product id")
End If
The error is at rs1.open
PLEASE HELP!!!!!
I'm searching a database to find a value in the database and once the value is found, it should update the row corresponding with the productid, which is the PK in which I'm using to search the database.
But I'm getting an error saying wrong number of arguments or invalid property assignment. My code looks like this:
Do While Not rs.EOF
If productid = rs!product_id Then
Set updatedb = New ADODB.Connectio n
updatedb.Open "DSN=waterdb;Pa ssword=andile;U ser ID=eco;Data Source=waterdb"
Set rs1 = New ADODB.Recordset
rs1.Open "Select product_id,qty, stock_date,tran s_type,qtydb from stock", "update stock set product_id=prod uctid", "update stock set qty=qty", "update stock set stock_date=date ", "update stock set trans_type=tran s_type", "update stock set qtydb=qtydb"
With Adodc1
.Recordset.Upda te
.Recordset.Fiel ds("product_id" ) = productid
.Recordset.Fiel ds("qty") = qty
.Recordset.Fiel ds("stock_date" ) = dop
.Recordset.Fiel ds("trans_type" ) = "trans_type "
.Recordset.Fiel ds("qtydb") = qtydb
End With
Else: MsgBox ("invalid product id")
End If
The error is at rs1.open
PLEASE HELP!!!!!