How can I have the auto number field starts with 1?

G

Grasshopper

Hi,

I have a table (with 1000 records) which I use to append data to. It
has a auto number field contains number from 1 to 1000. After I
deleted the 1000 records from the table and rerun the append query,
the auto number is not started at 1001. How can I have it started
from 1 again?

- Grasshopper -
 
J

Jason Lepack

<snipped from another post>

I created this procedure for resetting autonumbers.

You need to add the Reference:
"Microsoft ADO Ext. 2.8 for DDL and Security"


' *******************************************************************
' resestSeed - resets an autonumber field
' *******************************************************************
' tableName - the table that contains the autonumber
' fieldName - the field that is the autonumber
' seedValue - where you want the new autonumber to start
' *******************************************************************
Public Sub resetSeed(tableName As String, fieldName As String,
seedValue As Integer)
Dim cat As New ADOX.Catalog
Set cat.ActiveConnection = CurrentProject.Connection
cat.Tables(tableName).Columns(fieldName).Properties("Seed") =
seedValue
End Sub

Cheers,
Jason Lepack

<end snip>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top