Source language: Translate to:

Reset MS Access AutoInc Field

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Reset MS Access AutoInc Field

Postby David de Argentina » Tue Nov 19, 2013 2:55 pm

Save as "Reset_Autoinc" into the Functions Folder

Code: Select all
{NeoBook Function}
Version=5.80
Language=NeoBook
Param=[%1]|Text|Database ID
Param=[%2]|Text|Table Name
Param=[%3]|Text|AutoInc Field
{End}
dbpExecSQL "[%1]" "SELECT * INTO TempTable FROM [%2];" ""
dbpOpenTable "[%1]" "TempTable" ""
dbpDropField "[%1]" "TempTable" "[%3]"
dbpAddField "[%1]" "TempTable" "[%3]" "AutoInc"
dbpDropTable "[%1]" "[%2]"
dbpExecSQL "[%1]" "SELECT * INTO [%2] FROM TempTable;" ""
dbpDropTable "[%1]" "TempTable"


Usage:

Code: Select all
Call "Reset_AutoInc" "DB" "TableName" "ID"


Enjoy !
David de Argentina
User avatar
David de Argentina
 
Posts: 1559
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: Reset MS Access AutoInc Field

Postby dpayer » Wed Nov 20, 2013 8:14 am

David de Argentina wrote:Save as "Reset_Autoinc" into the Functions Folder
Enjoy !
David de Argentina



David, just to be clear, is the goal of this function to take an Access DB table, delete/modify the autoincrement column and then renumber from 1 (or from 0) the records in that column?

David P.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1382
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest