Set height of a form detail section using VB

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,462
Office Version
  1. 365
  2. 2021
  3. 2016
Platform
  1. Windows
Is it possible to change the height of the detail section of a form using VB? The height will depend on whether a variable at the top of the form is set to a particular value, or not.
TIA, Andrew :)
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Don't see why not.
Code:
Me.Detail.Height = 657

This code works but doesn't actually seem to have any visual effect.

What are you actually trying to do?
 
Upvote 0
Hi Norie and thanks for quick reply as well as the syntax. If I use the code, the screen 'pulses' (so it has accepted the command) but it doesn't resize - as you found out.

What am I trying to do? I have an invoice entry screen, and depending on the type of invoice that is selected at the top of the screen, a whole block of data is no longer required (it is hidden using the .Visible = No command), but I'm left with a great empty piece of real estate on my form (there are other controls in the footer). The intention was to resize the detail section to lose the empty space. It's one of those 'nice to have' things, rather than a 'need to have' - but you know what users are like with the form & report layouts.

I'm thinking I might need to 'requery' the form (if that is possible - much like you do with a query) after resetting the section size with the Me.Detail.Height command.

Thanks, Andrew :)
 
Upvote 0
Andrew

Don't think that will work either.

Why not have another form?
 
Upvote 0
Do you mean another form embedded in my existing form? Like a subform?

Late edit : the : DoCmd.MoveSize command seems to have the desired effect so I will experiment with it, in conjunction with the Me.Detail.Height.

Thanks for the pointer Norie.

Andrew :)
 
Upvote 0

Forum statistics

Threads
1,223,261
Messages
6,171,080
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top