473,387 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Resize subform to fit Detail Section

9
Hi There,

Im having a bit of a problem tryin to get my subform to automatically stretch to the size of the detail section when the main form changes size.
I have set the autoresize on both the main and subforms along with the can grow/shrink settings.

I also tried some code which almost worked on the onload event on the main form.

Me.frm_subAssetEdit.Height = Me.Section(0).Height

This would resize the subform to the original height of the detail section when first opened however on resize no change would take place even with a .Refresh call.

Anyhelp is greatly appreaciated.

Mike
Mar 2 '07 #1
5 25436
Rabbit
12,516 Expert Mod 8TB
The size of the main form will never change unless you do it through code. If you are doing this through code then you'll want to put the subform resize code in the same place.

If you're talking about maximizing the window and resizing the window by using the mouse, this does not increase the size of the form, this only increases the size of the window. The size of the form remains the same regardless of the size of the window.
Mar 2 '07 #2
MSeda
159 Expert 100+
you need to put the code in the form resize event.
Mar 3 '07 #3
mycall
9
>If you're talking about maximizing the window and resizing the window by
>using the mouse, this does not increase the size of the form, this only
>increases the size of the window. The size of the form remains the same
>regardless of the size of the window.

Yes this is what im refering too.

What is happening is that when i open the main form on computers with different resolutions the subform which takes up the entire space of my details section changes size. Whent he details sections changes size and becomes smaller the scroll bar on the side is then partly hidden and only the top arrow and half of the bar can be seen making it hard to scroll down the list of records in the subform.
Mar 5 '07 #4
Rabbit
12,516 Expert Mod 8TB
The easiest solution is to develop on the lowest resolution that it will be used on.
Mar 5 '07 #5
MSeda
159 Expert 100+
If you need to adjust for different screen sizes and resolution you can reference WindowWidth and WindowHeight.

This is just a sample of some code to format a form containing a tab control and some images. It takes a little trail and error to get the proportions right. But as you can see the code is very simple.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim img As Object
  3.  
  4. DoCmd.Maximize
  5. Me.Form.Width = Me.WindowWidth
  6. Me.Label9.Left = (Me.Form.Width - Me.Label9.Width) / 2    'center the label
  7. Me.Label10.Left = (Me.Form.Width - Me.Label10.Width) / 2    'center the label
  8. Me.TabCtl15.Width = Me.Form.Width * 0.98
  9. Me.Detail.Height = Me.WindowHeight * 0.86
  10. Me.TabCtl15.Height = Me.Detail.Height * 0.98
  11. For Each img In Me.Controls
  12. If TypeOf img Is Image Then
  13. img.Width = Me.TabCtl15.Width * 0.975
  14. img.Height = Me.TabCtl15.Height * 0.925
  15. End If
  16. Next
  17.  
  18. End Sub
the resize event I mentioned would be used to reformat the form if the user resizes it after opening it either by dragging the borders or using the control box.
Mar 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Sally | last post by:
In a subform that has no records, what is the white area? If a subform has records and you scroll the records, what is the white area after the last record? I would like to be able to click in...
6
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but...
3
by: lauren quantrell | last post by:
I have an Access 2000 form that I open showing only the header. The form's detail section visible property is set to false. The detail section contains a subform. Using a command button, I use the...
3
by: shaqattack1992-newsgroups | last post by:
Hello, I have a report with 2 subreports in the detail section. I have just changed the report so that if a "Ready" checkbox is checked yes, the background color of the detail section of the...
1
by: abprules | last post by:
I am trying to tab from my header to my detail section in a form that includes a tabcontrol form. It is not working. Can anybody suggest something. I have tried the following: Add a text box to...
1
by: jdicko5579 | last post by:
Hello: I am fairly new to Access and was wondering if someone could help me out. I have a main form with header. In the detail section of the main form, there is a subform. The subform has a...
7
by: FNA access | last post by:
I have a mainform that has a subform in the detail section and a subform in the footer section.(Both subforms are in datasheet view) When I click the navigation button to create a new record on the...
0
by: RLN | last post by:
Hello.... I have a subform with a header, detail and form footer. The form Header contains labels identifying the fields in the detail row. The Detail section contains 10 data fields (text...
2
by: dynamictiger | last post by:
I am building a wizard and have an issue with one sub form. Whilst all others are about 5 fields tall this one is 15 fields. My choices are either to resize the parent form ridiculously large for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.