Object Required error while adding new record in db using ADODC.


Hi, I am beginner in Visual Basic. I am doing a simple ADODC project using MS Acces. In that when I add new record to the database it gives me error 'Object Required'.
I tried the same code on different form but it is giving me same error. All the connections seem ok as the data is properly fetched at startup and ADODC control works fine navigating through db.
Please help me. My code is as follows...

Private Sub Form_Load()<br />
Set adoRecordset = New Recordset <br />
Private Sub cmdAdd_Click() <br />
On Error GoTo ErrLabel<br />
adoRecordset.AddNew<br />
Exit Sub <br />
ErrLabel:<br />
MsgBox Err.Description<br />
End Sub

If you enjoyed this post, subscribe for updates (it's free)

hello I think weare working

hello I think weare working on same kind of projects and can share our ideas and improv our projects this is my email adress if you like to contact "M_Naveed_09@yahoo.com"
i'm also beginner
Bye
___
{N}

Yes you can

Actually, to use the ADO data control to add a new record you just need a command button
that executes the following statement:

adodc1.Recordset.AddNew

where adodc1 is the name of your control.

Andy.

To use the ADO data control

To use the ADO data control to add a new record, set its EOFAction property to adDoAddNew.
Then you can press the last record button >| followed by > (next record) to start a new record.

You can either use the ADO data control or write everything yourself in ADO. Your code indicates
that you're trying to combine both of these methods. I suspect it is possible to manipulate the
recordSource of the ADO data control, but am not sure how.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.