I'm trying to record the "natural" height of certain controls on a report by setting the CanGrow and CanShrink properties to True. I keep getting an error message that reads: "you can't assign a value to this object." I'm trying to set a property, not assign a value to an object. I've only been doing Access VBA for about a week so I'm very new to this.
It's hanging up on the line "Me.Section(acDetail).CanGrow = True"
Here is my code:
Option Compare Database
Private shadeNextRow As Boolean
Const shadedColor = 8454143
Const normalColor = 16777215
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Choose a color based on the shadeNextRow value
If Abs([EST_FLOW]) > 250000000 Then
Me.Section(acDetail).BackColor = shadedColor
Else
Me.Section(acDetail).BackColor = normalColor
End If
'PART II: RECORD THE INITIAL HEIGHT OF THE CONTROLS IN THE REPORT
Me.Section(acDetail).CanGrow = True
Me.Section(acDetail).CanShrink = True
IHEST_DATE = Me.Controls![EST_DATE].Height
IHACT_DATE = Me.Controls![ACT_DATE].Height
IHBUS_LINE = Me.Controls![BUS_LINE].Height
IHINV_CENTER = Me.Controls![INV_CENTER].Height
Me.Section(acDetail).CanGrow = False
Me.Section(acDetail).CanShrink = False
Thank you so much - Cory
It's hanging up on the line "Me.Section(acDetail).CanGrow = True"
Here is my code:
Option Compare Database
Private shadeNextRow As Boolean
Const shadedColor = 8454143
Const normalColor = 16777215
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' Choose a color based on the shadeNextRow value
If Abs([EST_FLOW]) > 250000000 Then
Me.Section(acDetail).BackColor = shadedColor
Else
Me.Section(acDetail).BackColor = normalColor
End If
'PART II: RECORD THE INITIAL HEIGHT OF THE CONTROLS IN THE REPORT
Me.Section(acDetail).CanGrow = True
Me.Section(acDetail).CanShrink = True
IHEST_DATE = Me.Controls![EST_DATE].Height
IHACT_DATE = Me.Controls![ACT_DATE].Height
IHBUS_LINE = Me.Controls![BUS_LINE].Height
IHINV_CENTER = Me.Controls![INV_CENTER].Height
Me.Section(acDetail).CanGrow = False
Me.Section(acDetail).CanShrink = False
Thank you so much - Cory