472,780 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 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 25160
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.