Group:  Microsoft Access ยป microsoft.public.access.reports
Thread: Can Grow property in a report

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Can Grow property in a report
franky 25.08.2006 01:51:01
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!
RE: Can Grow property in a report
franky 25.08.2006 15:49:02
My fault. The problem was due to the width of the field being set to large.

Thanks.

"franky" wrote:

[Quoted Text]
> 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!

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net