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?