Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / May 2008

Tip: Looking for answers? Try searching our database.

RowHeight

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fred Zuckerman - 02 May 2008 16:30 GMT
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.Height = Msubfrmheight

Thanks To All,
Fred Zuckerman
Bruce - 02 May 2008 16:59 GMT
> 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
[quoted text clipped - 19 lines]
> 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.Height = Msubfrmheight

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

Bruce
Rick Brandt - 03 May 2008 00:19 GMT
> 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
[quoted text clipped - 19 lines]
> 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?

Signature

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

Fred Zuckerman - 03 May 2008 00:41 GMT
>> 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
[quoted text clipped - 28 lines]
> This also only applies to datasheet view.  Is that the view that your
> subform uses?

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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.