RowHeight

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fred Zuckerman

    RowHeight

    I'm trying to size a subform control to display all of the records (thus
    eliminating the vertical scroll bar). I know that the CanGrow property is
    only for printing.

    My thought was to determine the number of records in the subform and the
    current setting of RowHeight and use that to determine how to size the
    subform control.

    My problem seems to involve the RowHeight property. When I try to determine
    it's current value the property returns a value of True (-1) instead of the
    twips. What am I doing wrong?


    Dim Mreccount As Double
    Dim Msubfrmheight As Double
    Dim Mrowheight As Double

    Mreccount = Me.Child5.Form. RecordsetClone. RecordCount
    Mrowheight = Me.Child5.Form. RowHeight ''' <--this returns true, why?
    Msubfrmheight = (Mreccount + 2) * Mrowheight
    Me.Child5.Heigh t = Msubfrmheight

    Thanks To All,
    Fred Zuckerman



  • Bruce

    #2
    Re: RowHeight

    On May 2, 10:30 am, "Fred Zuckerman" <Zuckerm...@sbc global.netwrote :
    I'm trying to size a subform control to display all of the records (thus
    eliminating the vertical scroll bar). I know that the CanGrow property is
    only for printing.
    >
    My thought was to determine the number of records in the subform and the
    current setting of RowHeight and use that to determine how to size the
    subform control.
    >
    My problem seems to involve the RowHeight property. When I try to determine
    it's current value the property returns a value of True (-1) instead of the
    twips. What am I doing wrong?
    >
    Dim Mreccount As Double
    Dim Msubfrmheight As Double
    Dim Mrowheight As Double
    >
    Mreccount = Me.Child5.Form. RecordsetClone. RecordCount
    Mrowheight = Me.Child5.Form. RowHeight ''' <--this returns true, why?
    Msubfrmheight = (Mreccount + 2) * Mrowheight
    Me.Child5.Heigh t = Msubfrmheight
    >
    Thanks To All,
    Fred Zuckerman
    It's crazy, but it's returning -1 because it is set to the default
    value of 240 twips. Why it doesn't return 240, I don't know. But if
    you set it to 240 (or some other value) yourself then RowHeight will
    return the value you set, e.g.

    Mreccount = Me.Child5.Form. RecordsetClone. RecordCount
    Me.Child5.Form. RowHeight = 240
    Mrowheight = Me.Child5.Form. RowHeight ''' <--this will now return 240
    Msubfrmheight = (Mreccount + 2) * Mrowheight
    Me.Child5.Heigh t = Msubfrmheight

    Conversely, setting the RowHeight to -1 will restore the default value
    of 240.

    Bruce

    Comment

    • Rick Brandt

      #3
      Re: RowHeight

      Fred Zuckerman wrote:
      I'm trying to size a subform control to display all of the records
      (thus eliminating the vertical scroll bar). I know that the CanGrow
      property is only for printing.
      >
      My thought was to determine the number of records in the subform and
      the current setting of RowHeight and use that to determine how to
      size the subform control.
      >
      My problem seems to involve the RowHeight property. When I try to
      determine it's current value the property returns a value of True
      (-1) instead of the twips. What am I doing wrong?
      >
      >
      Dim Mreccount As Double
      Dim Msubfrmheight As Double
      Dim Mrowheight As Double
      >
      Mreccount = Me.Child5.Form. RecordsetClone. RecordCount
      Mrowheight = Me.Child5.Form. RowHeight ''' <--this returns true, why?
      Msubfrmheight = (Mreccount + 2) * Mrowheight
      Me.Child5.Heigh t = Msubfrmheight
      >
      Thanks To All,
      Fred Zuckerman
      According to the Help file -1 is the value that corresponds to setting the
      RowHeight to its default hieght for the current font.

      Instead of worrying about "getting" the RowHeight, just go ahead and set it.
      It will take some trial and error, but otherwise should work.

      This also only applies to datasheet view. Is that the view that your
      subform uses?

      --
      Rick Brandt, Microsoft Access MVP
      Email (as appropriate) to...
      RBrandt at Hunter dot com


      Comment

      • Fred Zuckerman

        #4
        Re: RowHeight

        "Rick Brandt" <rickbrandt2@ho tmail.comwrote in message
        news:4kNSj.1206 $To6.548@newssv r21.news.prodig y.net...
        Fred Zuckerman wrote:
        >I'm trying to size a subform control to display all of the records
        >(thus eliminating the vertical scroll bar). I know that the CanGrow
        >property is only for printing.
        >>
        >My thought was to determine the number of records in the subform and
        >the current setting of RowHeight and use that to determine how to
        >size the subform control.
        >>
        >My problem seems to involve the RowHeight property. When I try to
        >determine it's current value the property returns a value of True
        >(-1) instead of the twips. What am I doing wrong?
        >>
        >>
        > Dim Mreccount As Double
        > Dim Msubfrmheight As Double
        > Dim Mrowheight As Double
        >>
        > Mreccount = Me.Child5.Form. RecordsetClone. RecordCount
        > Mrowheight = Me.Child5.Form. RowHeight ''' <--this returns true, why?
        > Msubfrmheight = (Mreccount + 2) * Mrowheight
        > Me.Child5.Heigh t = Msubfrmheight
        >>
        >Thanks To All,
        >Fred Zuckerman
        >
        According to the Help file -1 is the value that corresponds to setting the
        RowHeight to its default hieght for the current font.
        >
        Instead of worrying about "getting" the RowHeight, just go ahead and set
        it. It will take some trial and error, but otherwise should work.
        >
        This also only applies to datasheet view. Is that the view that your
        subform uses?
        >
        --
        Rick Brandt, Microsoft Access MVP
        Email (as appropriate) to...
        RBrandt at Hunter dot com
        >
        Yes, the subform is in datasheet view.
        A previous reply from Bruce told me that the default value is 240 twips. So,
        like you and he recommend, I'll just set the RowHeight to 240, then the code
        should work fine.
        Thank You Very Much,
        Fred


        Comment

        Working...