Question : modify cangrow property dynamically

I have an MS Access 2007 report that I modify on the fly.  On the OnOpen Event, the code adjusts the Left and Width of each textbox, and it works fine.  I would like to also adjust the CanGrow property, but I get an error.

Report_rptMediaHitList.Controls("txtDetail1").CanGrow = False

Generates the error: "You can't assign a value to this object"

Thx!
cdmac

Answer : modify cangrow property dynamically

Correction to my code sample Below...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
Sub SampleRunCanGrowTrue()
    Dim strReportName As String
    Dim strControlName As String
 
    strReportName = "rptYourReport"
    strControlName = "YourControlName"
    
    DoCmd.OpenReport strReportName, acViewDesign
    Reports(strReportName).Controls(strControlName).CanGrow = True
    DoCmd.OpenReport strReportName, acViewPreview
End Sub
 
Sub SampleRunCanGrowFalse()
    Dim strReportName As String
    Dim strControlName As String
 
    strReportName = "rptYourReport"
    strControlName = "YourControlName"
    
    DoCmd.OpenReport strReportName, acViewDesign
    Reports(strReportName).Controls(strControlName).CanGrow = False
    DoCmd.OpenReport strReportName, acViewPreview
End Sub
Random Solutions  
 
programming4us programming4us