AccesobjectProperty and reports...huh?

  • Thread starter Thread starter Mark Burns
  • Start date Start date
M

Mark Burns

Ok, I think I grok this, but I guess I don't.

I want to access the description of reports and forms as displayed in the
database window in detail mode, if they exist.

I have a report.
I select it in the database window.
I right-click and select Properties from the pop-up menu.
I type in a description for the report and hit OK.
I see the desccription of the report in the database window.

"Ok," I think, "now the Accessobject for the report has an
AccessObjectProperty with Name="Description" and Value = <the stuff I just
typed in>...right?"

So I go to the immediate window and type:
?application.codeproject.allreports("my report name here").properties.count
answer: 0

HUH? Where the heck is the description for the dang report stored, then?

I need to grab this description WITHOUT having to open an instance of the
report...
HELP!
 
You access reports via this syntax (example is to show the name of a report
that is named "NameOfYourReport"):

CurrentDb.Containers("Reports").Documents("NameOfYourReport").Name
 
Just to add to Ken's answer:
CurrentDb().Containers("Reports").Documents("MyReport").Properties("Descript
ion")
generates error 3270 if nothing has been entered for the description.
 
Allen Browne said:
Just to add to Ken's answer:
CurrentDb().Containers("Reports").Documents("MyReport").Properties("Descript
ion")
generates error 3270 if nothing has been entered for the description.

Thanks!

....just out of curiosity, is this actually documented anywhere where a
typical human might eventually be able to find it, or must one upgrade to
the Klingon (brain-installed-upsidedown-and-backwards) mind in order to
figure this seemingly obscure &$#*&$^#% stuff out?
 
In VBE Help (must be in VBEditor), do Index search on the following:

Database;collection;

That'll get you in the ballpark!
 
Ken Snell said:
In VBE Help (must be in VBEditor), do Index search on the following:

Database;collection;

That'll get you in the ballpark!

er... huh? I'm not concerned about collections, dude.

how does that shed any light on report document properties?
....and whether a particular item shows up thru AccessObject(s) or this
Containers("...").Documents("...") way of looking at the DB objects (and why
the heck does it show up under 1 method and not the other??)
Finding out this stuff is the kind of crud that can drive you absolutely
nuts!
 
Mark, there are always so many ways to try to do something in Access that it
can be frustrating working out which ones work, and then which will be the
most efficient. That only comes with experience, so be patient with
yourself.

The vast majority of the information about the form and its properties can
only be gained if you open the form itself - in design view, and hidden if
you wish.
 
...just out of curiosity, is this actually documented anywhere where a
typical human might eventually be able to find it,

To be honest, there is practically no reason to want to access the
description properties programatically. It is not unreasonable to assume
that people who actually need it already know enough about the Access/ DAO
model to be able to nose around the help files until they get there, or
have access to programming books/ manuals that will refer to the same.

Have you tried looking up "description" in the VBA help file? On my system,
it's the ninth entry -- although it's painfully true that recent MS help
files are unreliable and usually broken.

B Wishes


Tim F
 
Hello Mark,

How is the issue going on your side? Does Allen's suggestions address your
problem? Let us know if you need further assistance on this issue.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Michael (/ "Yuan"?)

Allen's information did get me going, but I still wonder why there's such
inconsistency within Access over these seemingly little things (seemingly
little until you're tripping over them and losing hours figuring out why the
$&#%$! things aren't working as the documentation suggests they should) -
and why they're sometimes so poorly documented to begin with.

- Mark
 
Hellow Mark,

Currently, I am performing some further research on the cause of this
strange behavior. I will update you later. In the mean time, if you have
any other useful information, please feel free to let me know. Thanks for
your understanding.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
"Yuan Shao" said:
Hellow Mark,

Currently, I am performing some further research on the cause of this
strange behavior. I will update you later. In the mean time, if you have
any other useful information, please feel free to let me know. Thanks for
your understanding.

Regards,

Michael Shao
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
"Yuan Shao" said:
Hellow Mark,

Currently, I am performing some further research on the cause of this
strange behavior. I will update you later.

Cool! - I'd appreciate that.
 
Here's the code I came up with...FYI

Public Function GetDescription(strName As String) As String
Dim strDesc As String, bFnd As Boolean
Dim n As Variant, nn As Variant
Dim i As Integer, ii As Integer

strDesc = ""
bFnd = False
For i = 0 To CurrentDb.Containers("Reports").Documents.Count - 1
If CurrentDb.Containers("Reports").Documents(i).Name = strName Then
For ii = 0 To
CurrentDb.Containers("Reports").Documents(i).Properties.Count - 1
'Set nn = CurrentDb.Containers("Reports").Documents(i).Properties(ii)
If CurrentDb.Containers("Reports").Documents(i).Properties(ii).Name =
"Description" Then
strDesc =
CurrentDb.Containers("Reports").Documents(i).Properties(ii).Value
bFnd = True
Exit For
End If
Next
End If
Next
If Not bFnd Then
For i = 0 To CurrentDb.Containers("Forms").Documents.Count - 1
If CurrentDb.Containers("Forms").Documents(i).Name = strName Then
For ii = 0 To
CurrentDb.Containers("Forms").Documents(i).Properties.Count - 1
'Set nn =
CurrentDb.Containers("Reports").Documents(i).Properties(ii)
If CurrentDb.Containers("Forms").Documents(i).Properties(ii).Name =
"Description" Then
strDesc =
CurrentDb.Containers("Forms").Documents(i).Properties(ii).Value
bFnd = True
Exit For
End If
Next
End If
Next
End If
GetDescription = strDesc

End Function
 
Hello Mark,

I am continuing to investigate this issue on your behalf. Their may be
subtle differences within the two object models. I need to research this
further before I can provide a definitive response. I do appreciate your
patience,

Kind regards,
Orlanzo Ross
Microsoft Online Product Support Services
 
Mark,

I appreciate your patience as I continued to investigate this issue on your
behalf. This issue appears to be an issue with Access. I have created a
"bug" reporting the issue to the Access development team.

It is not possible to provide a definite timeline regarding the
availability of a fix. That will depend on a number of factors. Please
refer to http://office.microsoft.com/officeupdate often. When a correction
for this issue becomes available, it will be posted to this site.

Please let me know if you have any other questions or concerns regarding
this issue.

Best regards,
Orlanzo Ross
Microsoft Online Product Support Services.
 
Orlanzo,

Thanks!

BTW, I really appreciate the way Microsoft (or at least, you and
Michael/"Yuan Shao") is taking the time and energy to participate here in
the newsgroups. I, for one, really appreciate your efforts here.
 
Back
Top