Hi all my favorite Access elves, and happy NewYear.
Im trying to modify a tabledef by code, and I seem to be running into some trouble.
I am still in the early phases of getting an understanding on how to do it, and im allready stumped at simply refering to the tableDef.
I have tried this:
But I get the error:
Object is invalid or no longer set. (Error 3420)
The same happens for the code:
However if I use:
It will run just fine, and output the values requested.
Maybe my brain has melted during the holidays, but I simply cannot wrap my head around why the 2 first examples are giving the error, and whether there is a less clumsy way to proceed then the last posted bit of code.
Im trying to modify a tabledef by code, and I seem to be running into some trouble.
I am still in the early phases of getting an understanding on how to do it, and im allready stumped at simply refering to the tableDef.
I have tried this:
Code:
With CurrentDb.TableDefs("hist_tbl_Obs")
Debug.Print .Name & ":" & .SourceTableName
End With
Object is invalid or no longer set. (Error 3420)
The same happens for the code:
Code:
Dim T as dao.tabledef
set T=CurrentDb.TableDefs("hist_tbl_Obs")
Debug.Print T.Name & ":" & T.SourceTableName
However if I use:
Code:
Dim t As TableDef
For Each t In CurrentDb.TableDefs
If t.Name = "hist_tbl_Obs" Then
Debug.Print t.Name & ":" & t.SourceTableName
End If
Next
Maybe my brain has melted during the holidays, but I simply cannot wrap my head around why the 2 first examples are giving the error, and whether there is a less clumsy way to proceed then the last posted bit of code.
Comment