dear frnz...

There is some problem in d code in one of my form...
m having a table as Billable in oracle db. M using Oracle 10g.
M done with the coding part..i mean all kinda validations
bt when i try to save the data in table..it gives me the error as

"Object variable or with block variable not set"

and when i debug the program it gives me error in ADODC.RECORDSET.UPDATE
I had checked the connction string and recordsource, they are correct.
Can anyone please temme where m wrong.
Here is d code of my form:

cmdblogout.Enabled = True
cmdbsearch.Enabled = True
cmdbadd.Enabled = True
cmdbedit.Enabled = True
cmdbfirst.Enabled = True
cmdbprev.Enabled = True
cmdbnext.Enabled = True
cmdblast.Enabled = True
cmdbsave.Enabled = False
cmdbcncl.Enabled = False
cmdbexit.Enabled = False
Adodc3.Recordset.Update
frmb.Enabled = False
Adodc3.RecordSource = "select * from billable"
Adodc3.Refresh

Thanx in advance...:)
I hope my problem is clear to u ppl...

Recommended Answers

All 7 Replies

simply try to use this format

con.BegiTtrans       'con is the adodb connection object
con.execute "your update statment ...."
con.CommitTrans

Hi,

For the ADODC, have you set the Database and Record source property...?
And why "Update" without Addnew or Edit..?

Regards
Veena

To DebasisDas

Thanx for ur suggessions but...
M actually looking forward for something with adodc
i mean adodc.recordset.update query
so plz kindly help me out with that..

Regards
Era

Dear Veena

M done with the property part of ADODC
i.e. by setting recordsource and connection string
m here using adodc.recordset.update under the SAVE BUTTON
in ADD button, i did recordset.addnew
here is the code :

Private Sub cmdbadd_Click()
'----------------------------Billable add btn--------------------------
cmdblogout.Enabled = False
cmdbsearch.Enabled = False
cmdbadd.Enabled = False
cmdbedit.Enabled = False
cmdbfirst.Enabled = False
cmdbprev.Enabled = False
cmdbnext.Enabled = False
cmdblast.Enabled = False
cmdbsave.Enabled = True
cmdbcncl.Enabled = True
cmdbexit.Enabled = True
frmb.Enabled = True
Adodc3.Recordset.AddNew
End Sub

Private Sub cmdbcncl_Click()
'----------------------------Billable cancel btn--------------------------
cmdblogout.Enabled = True
cmdbsearch.Enabled = True
cmdbadd.Enabled = True
cmdbedit.Enabled = True
cmdbfirst.Enabled = True
cmdbprev.Enabled = True
cmdbnext.Enabled = True
cmdblast.Enabled = True
cmdbsave.Enabled = False
cmdbcncl.Enabled = False
cmdbexit.Enabled = True
frmb.Enabled = False
Adodc3.RecordSource = "select * from billable"
Adodc3.Refresh
End Sub

Private Sub cmdbedit_Click()
'----------------------------Billable edit btn--------------------------
cmdblogout.Enabled = False
cmdbsearch.Enabled = False
cmdbadd.Enabled = False
cmdbedit.Enabled = False
cmdbfirst.Enabled = False
cmdbprev.Enabled = False
cmdbnext.Enabled = False
cmdblast.Enabled = False
cmdbsave.Enabled = True
cmdbcncl.Enabled = True
cmdbexit.Enabled = True
frmb.Enabled = True
End Sub

Private Sub cmdbfirst_Click()
'----------------------------Billable first btn--------------------------
Adodc3.Recordset.MoveFirst
End Sub

Private Sub cmdblast_Click()
'----------------------------Billable last btn--------------------------
Adodc3.Recordset.MoveLast
End Sub

Private Sub cmdbnext_Click()
'----------------------------Billable next btn--------------------------
Adodc3.Recordset.MoveNext
If Adodc3.Recordset.EOF Then
Adodc3.Recordset.MoveLast
End If
End Sub

Private Sub cmdbprev_Click()
'----------------------------Billable previous btn--------------------------
Adodc3.Recordset.MovePrevious
If Adodc3.Recordset.BOF = True Then
Beep
Beep
Beep
Beep
Adodc3.Recordset.MoveFirst
End If
End Sub


I think the above code is correct...but if u think there is some prob..then plz do lemme knw

Love
Era

hello can u try putting 2 adodc.refresh to your form load and on your update button.. sometimes in vb6 one adodc.refresh is not enough that's why you got that error..

also before the addnew please put also 2 adodc.refresh..


try it and see if it works..

hello can u try putting 2 adodc.refresh to your form load and on your update button.. sometimes in vb6 one adodc.refresh is not enough that's why you got that error..

also before the addnew please put also 2 adodc.refresh..


try it and see if it works..

hey thanx 4 ur suggession..it really work...
well even i did smthing by myself also..
i change the code

adodc3.recordset.update

to

adodc3.recordset.addnew

But can anyone plz suggest me...how to use
adodc.recordset.update code..u cn check my code in above posts
my task is to update the details entered in the form thru adodc.recordset.update
Is there any other query to update the record
M using Oracle 10g...kindly plz dont suggest me anything related with access

Thanx
Era

i would still suggest o use ADODB objects

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.