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 / March 2007

Tip: Looking for answers? Try searching our database.

Actual 'used' width of a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
robert.waters - 08 Mar 2007 19:27 GMT
Does anyone have a code resource for determining the actual used width
of a form?
I would like to know the minimum width that a form can have without
hiding any of it's controls/subforms.
Damon Heron - 08 Mar 2007 19:42 GMT
You could loop thru all the controls on the form and add the control's left
and width properties, which will give you the right most number of the
control (in twips).  You could store results in an array and find the
largest number, which would be the fartherest right point of a control.  I
am winging it here, don't have any code other than a

Debug.Print Me![somecontrol].Left + Me![somecontrol].Width

HTH get you started
Damon

> Does anyone have a code resource for determining the actual used width
> of a form?
> I would like to know the minimum width that a form can have without
> hiding any of it's controls/subforms.
Douglas J. Steele - 08 Mar 2007 19:58 GMT
Loop through the Controls collection, and find the largest values of Left +
Width for the form:

Dim ctlCurr As Control
Dim lngMaxSize As Long

 For Each ctlCurr In Me.Controls
   With ctlCurr
     If .Left + .Width > lngMaxSize Then
       lngMaxSize = .Left + .Width
     End If
   End With
 Next ctlCurr

 MsgBox "The form needs to be at least " & _
   lngMaxSize & " twips."

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Does anyone have a code resource for determining the actual used width
> of a form?
> I would like to know the minimum width that a form can have without
> hiding any of it's controls/subforms.
 
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.