Return the value of a auto incrementing field from Addnew rec

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acortez
    New Member
    • Oct 2006
    • 1

    Return the value of a auto incrementing field from Addnew rec

    How can I possibly get the value from a newly inserted record in access db where the datafield type is autoincrement? I don't think querying for the newly inserted data is the best solution. or is it? -My application is written in VB using Access as the database.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by acortez
    How can I possibly get the value from a newly inserted record in access db where the datafield type is autoincrement? I don't think querying for the newly inserted data is the best solution. or is it? -My application is written in VB using Access as the database.
    I think you'll find you can read the value of the auto field as soon as you do the AddNew, before doing Update.

    Comment

    • PEB
      Recognized Expert Top Contributor
      • Aug 2006
      • 1418

      #3
      And if really you needto do Update
      so you do:
      rs.Update
      And than

      Rs.edit

      and you can use, i'm sure the ID autoincrement

      :)

      Comment

      Working...