Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Is it possible to allow a text box to grow and not grow in code?

    I am trying to use the following, but with no success:

    [codebox]If Forms![frmSelection]![chkLocLevel] = False Then
    Me.GroupFooter6.BackColor = 16777215
    Me.txtPCFtr.CanGrow = False
    Else
    Me.GroupFooter6.BackColor = 15132390
    Me.txtPCFtr.CanGrow = True
    End If[/codebox]


    The background color changes as requested, but I get an error message on the CanGrow lines. I am probably not using the correct syntax, but I can't find the right syntax anywhere.

    Any ideas are greatly appreciated.

    Ken

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    The CanGrow and CanShrink properties can only be set in design view, not in runtime. From the VBA help for CanGrow Property:
    You can set this property only by using the section or control's property sheet.
    (...)
    This property setting is read-only in a macro or Visual Basic in any view but Design view.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='782259' date='29-Jun-2009 00:30']The CanGrow and CanShrink properties can only be set in design view, not in runtime. From the VBA help for CanGrow Property:[/quote]
    Thanks Hans. I guess the alternative is to have two controls, one with CanGrow set to yes and one to no, then make one or the other visible at runtime.

    Is there a better alternative?

    Thanks again for your ideas.

    Ken

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    [quote name='kwvh' post='782355' date='29-Jun-2009 22:58']Is there a better alternative?[/quote]
    Offhand, I can't think of one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •