Can't read an object's Description Property when it contains data

G

GS

I am unable to read the description for a macro even though I see it
in the application. I am using the Northwind mdb which installed with
access 2003.

I can read the Name, DateCreated, and DateModified without a problem,
but can't read the description. I have tried:

1. srtrDesc = obj.Properties("Description").Value /
obj.Properties.Item("Description").Value Which generates the
following error: You entered an expression that has an invalid
reference to the property 'Description'

I tried iterating through the properties collection for the macro
object and discoved there were no properties present in the
collection. The count was 0.

2. strDesc = app.CurrentDb.Containers("Macros").Documents(strName).Properties("Description").Value
Which generates the following error: Item not found in collection
error.

I have seen reported problems where the Description property is not
added until it is first used, but in this case I can see the
descriptions for the macros through the application, I just can't read
them through code.

My code is as follows:
<CODE>
Set app = New Access.Application
app.OpenCurrentDatabase strDB 'Local northwind mdb
app.Visible = False

'process Macros
For Each obj In app.CurrentProject.AllMacros

strName = obj.Name
Debug.Print strName

strDesc = app.CurrentDb.Containers("Macros").Documents(strName).Properties("Description").Value
Debug.Print strDesc

strModified = obj.DateModified
Debug.Print strModified

strCreated = obj.DateCreated
Debug.Print strCreated

Next obj
</CODE>
 
A

Allen Browne

The "item not found" refers to the Macros collection.
They are called "Scripts".

Try:
CurrentDb().Containers("Scripts").Documents(0).Properties("Description")
 

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