How to Access description of a Form object

  • Thread starter Thread starter sampathsubramanian
  • Start date Start date
S

sampathsubramanian

Hi Folks,

I need some help in VBA coding..
I have an application in which my backend data is stored in SQL Server 2005 .
Front end has been written in MS-Access 2002, so it is obvious that the front
end is an Access Database which contains forms, reports and queries.

My current task at hand: There are forms and sub-forms in the front end
database. Only the form objects and report objects have "description" on
them apart from the "form.Name".
I need to write the code snippet to read the front-end database and display
the form and report Descriptions of only those objects which have
descriptions.

Can somebody help me please...
Thanks in advance

Sampath
 
Sounds like an extremely unusual requirement. I can't imagine why you'd need
code to display an unknown number of forms and reports: open forms and
reports is usually something that the user does depending on what activity
they're trying to do.

I suppose you could do something like:

On Error Resume Next

Dim dbCurr As DAO.Database
Dim docCurr As DAO.Document
Dim strDescription As String

Set dbCurr = CurrentDb()
For Each docCurr In dbCurr.Containers("Forms").Documents
strDescription = docCurr.Properties("Description")
If Err.Number = 0 Then
DoCmd.OpenForm docCurr.Name
End If
Next docCurr
For Each docCurr In dbCurr.Containers("Reports").Documents
strDescription = docCurr.Properties("Description")
If Err.Number = 0 Then
DoCmd.OpenReport docCurr.Name
End If
Next docCurr
 
Back
Top