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

Tip: Looking for answers? Try searching our database.

Width property of form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Victoria - 02 Mar 2007 23:06 GMT
I have a form that shows what is normally needed by the user.  I want to be
able to click a button labelled 'Extend' to widen the form to the right,
revealing details not normally needed.  Why doesn't this code fragment work
in the button's On Click event?

   Forms!frmOrders.Width = 10080
Rob Parker - 02 Mar 2007 23:47 GMT
Try resizing the window to fit the new form's width.  The form size and the
window size are not the same thing.

   Forms!frmOrders.Width = 10080
   DoCmd.RunCommand acCmdSizeToFitForm

HTH,

Rob

>I have a form that shows what is normally needed by the user.  I want to be
> able to click a button labelled 'Extend' to widen the form to the right,
[quoted text clipped - 3 lines]
>
>    Forms!frmOrders.Width = 10080
Victoria - 03 Mar 2007 03:01 GMT
Rob - that's perfect
thanks!

> Try resizing the window to fit the new form's width.  The form size and the
> window size are not the same thing.
[quoted text clipped - 13 lines]
> >
> >    Forms!frmOrders.Width = 10080
Victoria - 03 Mar 2007 03:18 GMT
hello Rob - I spoke too soon.  The 'more details' button works exactly as you
said it would, expanding the window to reveal 'more details' on the form's
right side. But the 'less details' button (both buttons are superimposed with
only one visible at a time) doesn't work.  When I set the form width to, say
6000 then use DoCmd.RunCommand acCmdSizeToFitForm, the Window will not shrink
enough to  hide any controls.  It only will shrink to the right edge of the
furthest right textbox.  I need to be able to cover these areas of the form.  
Any more clues?

Thank you

> Try resizing the window to fit the new form's width.  The form size and the
> window size are not the same thing.
[quoted text clipped - 13 lines]
> >
> >    Forms!frmOrders.Width = 10080
Sophie - 03 Mar 2007 05:07 GMT
I think you are looking for something like this.

   DoCmd.MoveSize 5440, 3400, 12000, 8150

Hope this helps
Signature

Thanks
Sophie

> hello Rob - I spoke too soon.  The 'more details' button works exactly as you
> said it would, expanding the window to reveal 'more details' on the form's
[quoted text clipped - 24 lines]
> > >
> > >    Forms!frmOrders.Width = 10080
roger - 26 Apr 2007 05:12 GMT
hi sophie
many thanks - exactly what i was looking for ! great !
cheers and until soon
roger
ballarat, australia
info@magictours.com.au

> I think you are looking for something like this.
>
[quoted text clipped - 30 lines]
> > > >
> > > >    Forms!frmOrders.Width = 10080
Rob Parker - 03 Mar 2007 05:17 GMT
Hi Victoria,

You can't set the form width to less than the position of the right-hand
edge of the right-most control(s); although you may be attempting to do so
in code, the command will simply set the width to the minimum possible
width, rather than the actual value you specify (and no error is generated).
The SizeToFitForm command will always show these controls, and it will only
resize the form to the edge of these controls (even if they are hidden).

Rather than resizing your form, you should use the MoveSize command to
resize the window.  This command takes up to four parameters - right, down,
width, height; any parameters omitted are not changed.  For example:
   DoCmd.MoveSize , , 2000
will resize the window to 2000 twips wide, without changing its position or
height.

If your form has scrollbars enabled, the resize (to a narrower width) will
probably cause a horizontal scrollbar to appear.  You can prevent this by
setting the form's scrollbar property to either Vertical or None.

HTH,

Rob

> hello Rob - I spoke too soon.  The 'more details' button works exactly as
> you
[quoted text clipped - 33 lines]
>> >
>> >    Forms!frmOrders.Width = 10080
 
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.