Problem with addnew method

Hello

I am trying to add a new record to my recordset 'Adodc' on the form load event.  I've tried:

Adodc.Recordset.AddNew "partno"

but I get errors.  'partno' is the key field in my recordset, but there are also 3 other fields.  Do I need to duplicate my statement for each of those other fields as well?

Any help would be very appreciated.

Thanks

Jeremy
JermyDAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RogueSolutionsCommented:

You need to specify the fields a bit more so ...

    With Adodc.recordset
        .AddNew
        !PartNo = 12345
        !Field1 = 23
        !Field2 = 'text entry'
        !Field3 = True
   End With

I am assuming that all your fields are required and that Field1 is numeric, 2 is text and 3 is a boolean  (or Yes/No in access)

You must already have opened your recordset for this to work.

0
RogueSolutionsCommented:
Sorry, missed the Update statement ...

---

You need to specify the fields a bit more so ...

    With Adodc.recordset
        .AddNew
        !PartNo = 12345
        !Field1 = 23
        !Field2 = 'text entry'
        !Field3 = True
        .Update
    End With

I am assuming that all your fields are required and that Field1 is numeric, 2 is text and 3 is a boolean  (or Yes/No in access)

You must already have opened your recordset for this to work.

 
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JermyDAuthor Commented:
Thanks!  Works great.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.