Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    5

    Unanswered: connection class not registered (ADO)

    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(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

  2. #2
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238

    Re: connection class not registered (ADO)

    Originally posted by Michelangelo
    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(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
    Have you looked for any broken references. In the code module go to Tools, References and see if any reference shows as Missing. If it is remove it and replace it, if required, with the correct one. This can happen if you run the database on 2 different machines that have different versions of Office running on them or installed or removed software.

    To reseed the auto number you can just use an append query to insert a new record with the number you want the auto number to start at

  3. #3
    Join Date
    Nov 2003
    Posts
    5
    Yes, i've checked it but no luck. I've got a lot of problems using ADO. not only the connection class doesn't work other classes don't work either. Also the help doesn't appear when an ADO subject is clicked. (The index is there). The help file is in the correct location on the HD and I can open it manually.

    Furthermore I've got a problem with Jet4.0. It always says that the provider is missing.

    I allready tried to completely remove and reinstall office 2000, but nothing changed. The strange thing is, it used to work on this machine.

    Any further insights are greatly apreciated.

    M.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •