Michelangelo
Registered User.
- Local time
- Today, 05:12
- Joined
- Dec 20, 2002
- Messages
- 37
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.
However, I think it's after a windows update, I now get the message that says "class not registered". In debugging mode it fails on the first line "Set cnn = CurrentProject.Connection".
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(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 want to use for the 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)
' sorry missed these when typing original post
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
However, I think it's after a windows update, I now get the message that says "class not registered". In debugging mode it fails on the first line "Set cnn = CurrentProject.Connection".
Are there any solutions?
Thanx