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 / Forms Programming / July 2005

Tip: Looking for answers? Try searching our database.

Adjusting the size of a subform using code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Craig - 24 Jul 2005 20:25 GMT
I have a subform that has a "TOTALS" textbox that is a calculated field. The
number of line items in it will change for each customer. I tried adding up
the heights of the form header & footer(0.1667) + Count of line items *
0.1667 so that the TOTALS will be right under the last line item. The CanGrow
and CanShrink on the subform and the subform details section are set to Yes.
I tried running this code and refresh the form and it does not work....

Any ideas?

TIA Craig
Graham Mandeno - 24 Jul 2005 23:15 GMT
Hi Craig

You need to change the height of the subform control that contains your
subform.

You are on the right track with adding up the different section heights, but
remember that the unit is TWIPs (TWentIeths of a Point), so there are 1440
TWIPs per inch.

Something like this should get you going:

   dim iHeight as integer
   With Me.SubformControl.Form
       iHeight = .Section(acHeader).height + .Section(acFooter).Height _
           + .Section(acDetail).height * .RecordsetClone.RecordCount
   End With
   Me.SubformControl.Height = iHeight

You might need to add on a few TWIPs (50 or so) to allow for dividing lines
and borders.
Signature

Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

>I have a subform that has a "TOTALS" textbox that is a calculated field.
>The
[quoted text clipped - 10 lines]
>
> TIA Craig
 
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.