Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Nov 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access 97 to Access 2000 upgrade problem (Access 2000)

    Access 97 application upgraded to Access 2000. Form gets error "Invalid Operation"

    The offending lines of code:

    Dim MyDB As DAO.Database, Operator_CertNo As DAO.Recordset
    Set Operator_CertNo = MyDB.OpenRecordset("Certificate", DB_OPEN_TABLE)

    Have tried setting a reference to:
    Microsoft DAO 3.6 Object Library
    Microsoft DAO 2.5/3.5 Compatiblity Library
    Microsoft DAO 3.51 Object Library

    If I omit the type of recordset in the openrecordset, it gets past this line:

    Set Operator_CertNo = MyDB.OpenRecordset("Certificate")

    But then bombs on the line that goes to use a index to find a record:

    Operator_CertNo.Index = "Certificate_Number"

    This is an old application that was written by some one else. It has several similar chunks of code and they all seem to have the same problem.

    Thanks in advance

    Gary

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Access 97 to Access 2000 upgrade problem (Access 2000)

    Welcome to Woody's Lounge!

    The DAO reference to use in Access 2000 (as well as in Access 2002 and 2003) is the 3.6 version. You could replace the Access 2 constant DB_OPEN_TABLE with dbOpenTable, but that is not essential, the old constant is still available for compatibility reasons.

    There should be a line

    Set MyDB = CurrentDb

    between the declarations and the Set Operator_CertNo line. Assuming that Certificate is the name of the table and that Certificate_Number is the name of an index in that table (not necessarily the same as the name of a field), the code should work.

  3. #3
    New Lounger
    Join Date
    Nov 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access 97 to Access 2000 upgrade problem (Access 2000)

    The line

    Set MyDB = CurrentDb

    is there. I just didn't think to include it in my first post. Here is a more complete listing.

    Dim MyDB As DAO.Database, Operator_CertNo As DAO.Recordset, Cert_No As String, Operator_Name As DAO.Recordset
    Set MyDB = CurrentDb
    Set Operator_CertNo = MyDB.OpenRecordset("Certificate", DB_OPEN_TABLE)

    Thanks

    Gary

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Access 97 to Access 2000 upgrade problem (Access 2000)

    I'm afraid that it's impossible to say what's wrong without seeing the database. If you wish, you can post a stripped down copy of your database, so that Loungers can investigate the problem directly. See <post#=401925>post 401925</post#> for instructions.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Access 97 to Access 2000 upgrade problem (Access 2000)

    Is this a local table? If not, you can't use either DB_OPEN_Table or dbOpenTable because those do not apply to attached tables. In either case, it should work with dbOpenDynaset.
    Charlotte

  6. #6
    New Lounger
    Join Date
    Nov 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access 97 to Access 2000 upgrade problem (Access 2000)

    That is it. This is a linked database. I changed all the recordsets from table type to dynaset and got rid of places where it was using the index of the recordset and things are working now.

    You guys Rock!

    Thanks

    Gary

Posting Permissions

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