'Inherited' property reference ?

V

VegaLA

Hi all, I have the following code in a module

"Sub exeProperties()

Dim db As Database
Dim tbl As TableDef
Dim prp As Property
Dim str As String

Set db = CurrentDb
Set tbl = db!Books

str = ""

For Each prp In tbl.Properties
str = str & prp.Name
str = str & " = " & prp.Value
str = str & " (" & prp.Type & ") "
str = str & prp.Inherited & vbCrLf
Next prp

MsgBox "Books has " & tbl.Properties.Count _
& " Properties: " & vbCrLf & str

End Sub"

but the line "str = str & prp.Inherited & vbCrLf"
is coming back with this error "Compile Error: Method or data member not
found" and I suspect I need to add a reference for the .inherited property ?
Can anyone point me in the rigth direction if that is not the case or tell
me which reference I need to add in order for this to work ?

Thanks in advance,
Mitch....
 
D

Douglas J. Steele

What are you hoping to see?

The Help file has the following to say about the Inherited property:

"Microsoft Access defines a number of properties that apply to Data Access
Objects. Because these properties are defined by Microsoft Access, the
Microsoft Jet database engine doesn't recognize them automatically. To set
one of these properties by using Visual Basic, you must first create the
property by using the CreateProperty method and then append it to the
Properties collection of the object. For more information, search the Help
index for the Property object topic.

"When you create an object based on another object, the derived object
inherits the properties of the original object. You can use the Inherited
property to determine whether one of these properties was created for the
object it is applied to, or if the property was inherited from another
object.

"For example, suppose you want to set the Microsoft Access DatasheetFontName
property for a TableDef object. If you are setting this property for the
first time, you will need to create a corresponding Property object and
append it to the Properties collection of the TableDef object. The Inherited
property of the new Property object returns False (0).

"If you then create a new QueryDef object based on the table corresponding
to the TableDef object, the DatasheetFontName property will be included in
the Properties collection of the QueryDef object. The Inherited property of
a Property object corresponding to this property returns True (-1)."

Based on that, I wouldn't expect any of the properties in a TableDef object
to be inherited.
 
V

VegaLA

OK I see. I am reading through a tutorial from an Access book.
The code below should display the entire contents of the properties
collection for a tableDef object named Books. I may have jumped a step or
two, but I thought the problem was down to references.

I'll backtrack, thabnks for the help.
Mitch...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top