Caption Property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written a simple program that does some documenting of the
applications forms. However, I am missing one element the forms Caption
Property.

I have included the code that I wrote:

For i = 0 To con.Documents.Count - 1
x = con.Documents(i).Properties("Description")
If Left(x, 1) = "(" Then
rs.AddNew
rs!FormID = Mid(x, 1, 8)
rs!FormName = con.Documents(i).Name
'*************************************************
' the following line of code does not appear to do anything.
' It most certainly doesn't acquire the "Caption" property values.
'*************************************************
rs!formcap = con.Documents(i).Properties("Caption")
rs!formdesc = x
rs.Update
End If
Next

thanks Dean

I am using Access 97
 
turner said:
I have written a simple program that does some documenting of the
applications forms. However, I am missing one element the forms
Caption Property.

I have included the code that I wrote:

For i = 0 To con.Documents.Count - 1
x = con.Documents(i).Properties("Description")
If Left(x, 1) = "(" Then
rs.AddNew
rs!FormID = Mid(x, 1, 8)
rs!FormName = con.Documents(i).Name
'*************************************************
' the following line of code does not appear to do anything.
' It most certainly doesn't acquire the "Caption" property values.
'*************************************************
rs!formcap = con.Documents(i).Properties("Caption")
rs!formdesc = x
rs.Update
End If
Next

thanks Dean

I am using Access 97

For that and other properties of the form object you're going to have to
open the form. You can open it, hidden, in design view, get the value of
the property, and then close it. Try revising as follows:

'----- start of revised code -----

Dim strFormName As String

For i = 0 To con.Documents.Count - 1
x = con.Documents(i).Properties("Description")
If Left(x, 1) = "(" Then
rs.AddNew
rs!FormID = Mid(x, 1, 8)
strFormName = con.Documents(i).Name
rs!FormName = strFormName

' open the form to get at its properties
DoCmd.OpenForm strFormName, _
acDesign, WindowMode:=acHidden
rs!formcap = Forms(strFormName).Caption
DoCmd.Close acForm, strFormName, acSaveNo

rs!formdesc = x
rs.Update
End If
Next

'----- end of revised code -----
 
Hi Dean

Caption is a property of a Form object, but what you have here is a Document
object. A Form object only exists when the form document is open, so what
you need to do is open it, grap the properties you require, and close it
again. It's best to open it in design view so that it doesn't run any code,
and hidden so you don't see it all happening.

DoCmd.OpenForm rs!FormName, acDesign, , , , acHidden
rs!FormCap = Forms(rs!Formname).Caption
DoCmd.Close acForm, rs!FormName
 
Back
Top