Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Lexington, NC

    Unanswered: Access Insert Query

    When I am inserting records into an Access database using insert into TABLENAME values(), how do I access the next value of an AutoNumber field. For example, I have an Access database on my web site to enter time sheet data, and I want to add a record. I can't use the .AddNew method, so I am trying to use an Insert query. The first field is an AutoNumber field as a Primary key. How do I insert a record and tell access to get the next value of the AutoNumber field?????
    Last edited by grimmettm; 08-24-02 at 12:29.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    what you have to do is not mention the autonumber column, and the next number will get assigned to it on the row being inserted

    e.g. if the table has col1, col2, col3, where col1 is the autonumber, then the insert statement is

    insert into yourtable (col2, col3)
    values ('value2','value3')


Posting Permissions

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