View Single Post
  #1  
Old April 29th, 2004, 02:11 PM
external usenet poster
 
Posts: n/a
Default reset autonumber value in table

Thanks! I will try this.

-----Original Message-----
ADOX example from Microsoft

Function ChangeSeed(strTbl As String, strCol As String,

lngSeed As
Long) As Boolean
'You must pass the following variables to this

function.
'strTbl = Table containing autonumber field
'strCol = Name of the autonumber field
'lngSeed = Long integer value you would like to use

for next
autonumber.

Dim cnn As ADODB.Connection
Dim cat As New ADOX.Catalog
Dim col As ADOX.Column

'Set connection and catalog to current database
Set cnn = CurrentProject.Connection
cat.ActiveConnection = cnn

Set col = cat.Tables(strTbl).Columns(strCol)

col.Properties("Seed") = lngSeed
cat.Tables(strTbl).Columns.Refresh
If col.Properties("seed") = lngSeed Then
ChangeSeed = True
Else
ChangeSeed = False
End If
Set col = Nothing
Set cat = Nothing
Set cnn = Nothing

End Function

(david)

"Elizabeth" wrote

in message
...
Anyone have a routine to reset an autonumber field to 1?



.