Can Grow property in a report

G

Guest

I have a report that needs to dynamically set some properties in textboxes
and labels. The "Can Grow" property is set to "yes". However, when I
attempt to dynamically set additional properties using code the Can Grow no
longer works. How would I get it to work?

Me.Controls("txtImageCaptionData" & i).Width = 5000
Me.Controls("txtImageCaptionData" & i).Height = 2000
Me.Controls("txtImageCaptionData" & i).Left = 3000
Me.Controls("txtImageCaptionData" & i).TextAlign = Left
Me.Controls("txtImageCaptionData" & i).ControlSource =
rst("FieldName")

Below is the full code that is being executed on the Open Event. I created
a roport with thumbnails and information about each image. There are label
and corresponding unbound textbox controls used for listing data for each
picture. Prior to opening the report a user can select the fields to display
and the order in which they will show. Some of these fields do not need
label captions while others do.

Dim rst As DAO.Recordset
Dim sql As String
Dim i As Integer


sql = "SELECT CaptionDescription, FieldName, ShowCaptions,
ContainsNumeric " & _
"FROM TEMP_SelectedCaptions " & _
"ORDER BY TEMP_SelectedCaptions.SortOrder"

Set rst = CurrentDb.OpenRecordset(sql)

i = 1

Do Until rst.EOF
If rst("ShowCaptions") Then
If rst("ContainsNumeric") Then
Me.Controls("txtImageCaptionData" & i).Format = "Standard"
Me.Controls("txtImageCaptionData" & i).DecimalPlaces = 0
End If
Me.Controls("txtImageCaptionData" & i).ControlSource =
rst("FieldName")
Me.Controls("lblCaption" & i).Caption = rst("CaptionDescription")
Else
Me.Controls("txtImageCaptionData" & i).Width = 5000
Me.Controls("txtImageCaptionData" & i).Height = 2000
Me.Controls("txtImageCaptionData" & i).Left = 3000
Me.Controls("txtImageCaptionData" & i).TextAlign = Left
Me.Controls("txtImageCaptionData" & i).ControlSource =
rst("FieldName")

End If
i = i + 1
rst.MoveNext

Loop
rst.Close


Thanks in advance!
 

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