Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005
    Posts
    74

    Unanswered: Retrieve the auto-increment column on insert

    Hi guys help please! i have a table with 3 columns (id,username,password) and id column has a auto-increment value. My question is, is it posible to retrive the id of the newly created row right after I insert it or in other words is it posible that the return value of insert command would be the id of the inserted data? Thanks advance!

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes!

    In the event procedure for [After Insert], you can reference the value of the ID by it's name.

    For example, in the After Insert procedure, the following code should throw back the ID to you in a message box:

    Code:
    MsgBox Me.ID
    Cheers

    ST
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •