• Object Invalid or no long set! (Access2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Object Invalid or no long set! (Access2000)

    Author
    Topic
    #436601

    This is driving me crazy.

    I have code something like this:

    dim tdef as dao.tabledef

    set tdef = currentdb.tabledefs(str)

    The “set tdef” line doesn’t raise an error (as long as str contains a valid tablename), but if I immediately try to do anything with tdef, I get “Error 3420: Object Invalid or no longer set!”. It is like it loses scope immediately after being set!

    At the same time, I’ve got tdef1 (defined same way) which is set via a For statement (For each tdef1 in currentdb.tabledefs), and works fine.

    Driving me crazy! Anyone have any ideas?

    Viewing 0 reply threads
    Author
    Replies
    • #1035596

      I had this problem in Access 97 and worked around it by explicitly defining a Database object:

      Dim dbs As DAO.Database
      Dim tdef As DAO.TableDef

      Set dbs = CurrentDb
      Set tdef = dbs.TableDefs(…)

    Viewing 0 reply threads
    Reply To: Object Invalid or no long set! (Access2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: