Hi,
I'm using a piece of code I found at mvps. And uptil now it has worked
perfectly. It resets the autonumber of a table to a specified number.
code:-----------------------------------------------------------------------
-------
Function ChangeSeed(strT bl 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 want to use for the next AutoNumber
Dim cnn As ADODB.Connectio n
Dim cat As New ADOX.Catalog
Dim col As ADOX.Column
'Set connection and catalog to current database
Set cnn = CurrentProject. Connection
cat.ActiveConne ction = cnn
Set col = cat.Tables(strT bl).Columns(str Col)
' sorry missed these when typing original post
col.Properties( "Seed") = LngSeed
cat.Tables(strT bl).Columns.Ref resh
If col.Properties( "Seed") = LngSeed Then
ChangeSeed = True
Else
ChangeSeed = False
End If
Set col = Nothing
Set cat = Nothing
Set cnn = Nothing
End Function
----------------------------------------------------------------------------
--
However, I think it's after a W2K (sp4) update, I now get the message that
says "class not registered". In debugging mode it fails on the first line
"Set cnn = CurrentProject. Connection".
Also all other ADO properties, MSJET stuff don't work. The references are in
place however.
Are there any solutions?
Thanx
I'm using a piece of code I found at mvps. And uptil now it has worked
perfectly. It resets the autonumber of a table to a specified number.
code:-----------------------------------------------------------------------
-------
Function ChangeSeed(strT bl 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 want to use for the next AutoNumber
Dim cnn As ADODB.Connectio n
Dim cat As New ADOX.Catalog
Dim col As ADOX.Column
'Set connection and catalog to current database
Set cnn = CurrentProject. Connection
cat.ActiveConne ction = cnn
Set col = cat.Tables(strT bl).Columns(str Col)
' sorry missed these when typing original post
col.Properties( "Seed") = LngSeed
cat.Tables(strT bl).Columns.Ref resh
If col.Properties( "Seed") = LngSeed Then
ChangeSeed = True
Else
ChangeSeed = False
End If
Set col = Nothing
Set cat = Nothing
Set cnn = Nothing
End Function
----------------------------------------------------------------------------
--
However, I think it's after a W2K (sp4) update, I now get the message that
says "class not registered". In debugging mode it fails on the first line
"Set cnn = CurrentProject. Connection".
Also all other ADO properties, MSJET stuff don't work. The references are in
place however.
Are there any solutions?
Thanx