Getting the uniqe ID when adding a row in Acces, u

Results 1 to 2 of 2

Thread: Getting the uniqe ID when adding a row in Acces, u

  1. #1
    Martin Henricsson Guest

    Default Getting the uniqe ID when adding a row in Acces, u

    Hi,<BR>I&#039m using an Access database. The table I&#039m inserting to consists of a unique AutoNumber, title, body and writer. I&#039m inserting the title, body and writer in the database, and the AutoNumber generates it self. Can I get this AutoNumber without having to do a second search?<BR><BR>ex.<BR><BR>SQL = "insert into table (title,body,writer) Values(&#039"& title &"&#039,&#039"& body &"&#039,&#039"& writer"&#039);"<BR><BR>What I want, is the AutoNumber that just created. As it is now, I do a second search:<BR><BR>SQL = "select AutoNumber from table where body=&#039"& body &"&#039 and title=&#039"& title &"&#039"<BR><BR>can I merge these together?<BR>

  2. #2
    Bruce Clark Guest

    Default RE: Getting the uniqe ID when adding a row in Acce

    Martin:<BR><BR>A great article on pulling the ID of the last record inserted is at:<BR><BR>http://kamath.com/tutorials/tut004_autonum.asp<BR><BR>Good luck,<BR><BR>Bruce Clark

Posting Permissions

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