Can't retrieve mdb-table property using ADO

M

Morten Snedker

I'm trying to retrieve the "Last changed" property of a table using
this code:

Dim obj As AccessObject, dbs As Object, prp As Property
Set dbs = Application.CurrentData

For Each obj In dbs.AllTables
If Left(obj.Name, 4) <> "msys" Then
For Each prp In obj.Properties
Debug.Print prp.Name
Next prp
End If
Next obj

It fails on the "For Each prp" -line with at runtime error 2467,
stating that i'm trying to refer to an object that i either closed or
has been deleted.

It's an mdb-file with internal tables (not linked). What am I doing
wrong?


Regards /Snedker
 
D

Douglas J. Steele

What version of Access? prp is an object in both the ADO and DAO object
models. To ensure that you get a DAO property (which is what you need in
this situation), change the declaration to

Dim prp As DAO.Property.

(If you wanted to guarantee that you get an ADO property, you'd use
ADODB.Property)
 
M

Morten Snedker

What version of Access? prp is an object in both the ADO and DAO object
models. To ensure that you get a DAO property (which is what you need in
this situation), change the declaration to

Dim prp As DAO.Property.

The DAO object library is not activated and i'm strictly using ADO...?

Regards /Snedker
 
¹

¹Ú¹®¼ö

Douglas J. Steele said:
What version of Access? prp is an object in both the ADO and DAO object
models. To ensure that you get a DAO property (which is what you need in
this situation), change the declaration to

Dim prp As DAO.Property.

(If you wanted to guarantee that you get an ADO property, you'd use
ADODB.Property)
 
Top