[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 374
  • Last Modified:

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
0
JermyD
Asked:
JermyD
  • 2
1 Solution
 
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
 
JermyDAuthor Commented:
Thanks!  Works great.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now