Question : Tabledefs - object not set or invalid ??

Two pieces of code

    Dim tbl As DAO.TableDef, db As DAO.Database, szConnect As String
    Set db = CurrentDb
    Set tbl = db.TableDefs("Funktionen")
    szConnect = tbl.Connect

AND

    Dim tbl As DAO.TableDef, szConnect As String
    Set tbl = CurrentDb().TableDefs("Funktionen")
    szConnect = tbl.Connect


The first works, the second gives me an error about the object not being set or no longer valid (on the line szConnect = ....).
Access 2007 running an Access 2003 format mdb database.

Why ?

Answer : Tabledefs - object not set or invalid ??

see this link


 "Object Invalid or No Longer Set" Error Using CurrentDb
http://support.microsoft.com/kb/167173

Random Solutions  
 
programming4us programming4us