problem understanding this code...

zambam

Registered User.
Local time
Today, 08:28
Joined
Mar 19, 2006
Messages
39
hi,

i have a loans table and a products table. i want to be able to update the field "borrowed" in the products table THROUGH THE LOANS form in VB6, by updating the recordset. so it would use the productID TO FIND THE RECORD (txtproductID), then update the "borrowed" field for that book.


i have created an adodc, but when i write this code, it says "ERROR. OBJECT VARIABLE OR WITH BLOCK VARIABLE NOT SET." And it highlights the '.open' part

Code:
Private Sub Command1_Click()

With Adodc1.Recordset
    .Open "select [borrowed?] from products where ["borrowed?"= false] And [product id]  = '" & txtproductID.Text & "'"",  adOpenDynamic, adLockOptimistic"
    .MoveFirst
    .Fields("borrowed?") = True
    .Update
    MsgBox "update successful"
    
    End With


please please help me to accomplish this. i have tried so hard for ages but cannot get it to work:confused: :confused: . i would really appreciate it.

thanks
 
Last edited:
Hang on a mo, I'm reading this all wrong.

What is adodc1 currently declared and set as?
 
Last edited:
well, ive connected it to the correct database but thats about it....

i used the adodc control by clicking the button from the left of the vb6 interface. i then went to properties and clicked on connection string etc etc...
 

Users who are viewing this thread

Back
Top Bottom