Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert old ID into autonumber field in Access

Status
Not open for further replies.

martiros

Technical User
Feb 1, 2003
113
US
How do I use SET IDENTITY_INSERT in ASP/Access project?
I've used it with SQL server but I'm not sure how to trigger it within Access...

There are many articles on the Internet on this subject but most of them use SQL Server as an example and just a few mention that this is possible in Access too - but how?
I was trying to use Connection and Command objects with no success.

Thank you
 
I just tried it, and you can insert the value. I have a table called Test, with an autonumber field called ID and a text field called CName. I ran ...

DoCmd.RunSQL "INSERT INTO test (ID,CName) VALUES(1,'Hello')"

It worked.
 
Norris68,
thank you for taking time for experimenting with autonum field insert.
It worked for me too.
But what is amazing is that couple of pros & several books/websites mentioned that it can't be done without setting IDENTITY_INSERT ON before actual INSERT statement...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top