Move and Maximize Sub forms

Hi All,

Is there a way to Maximize and move sub forms in the main form thru code in ms access 2010?
Please let me know if possible
Thanks
LVL 1
frimyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
Are you talking about changing the size of the subform, when the main form changes sizes?
0
John TsioumprisSoftware & Systems EngineerCommented:
I guess we need a screenshot of your current layout to "see" what you want to achieve and why...
0
frimyAuthor Commented:
Hi All
thanks for responding
see attach.
i want to be able to see more records in the sub form, so i want to be able to move the sub form up and then make it bigger in the bottom,
and then put back like it was before.
Thanks
Capture.JPG
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dale FyeOwner, Developing Solutions LLCCommented:
you might consider using a tab control, and moving some of the other data to a tab.

but one method to do this would simply be to add a button, maybe in the top right corner above the subform, and when clicked, you would move that button upwards to some location, then move the top of the subform just below that button and then increase the height of the subform.  

Then, when the user clicks that same button again, you would decrease the height of the subform to it's original height and set the Top property back to its original value and move the button back to its original location.

This would work sort of like how the you can hide and reveal the navigation pane.
0
frimyAuthor Commented:
<<  you would move that button upwards to some location  >>
can you explain how to move a button and then the subform in code.
Thanks
0
Dale FyeOwner, Developing Solutions LLCCommented:
Start out by creating a button, name it cmd_Resize, and place it just above the subform.  Note the Top property of this button and of the subform.  Make the caption on the button something like "Increase".  Then the code behind that button would be something like the code below (this is untested, but should work properly).
Private cmd_Resize_Click

    Dim sngOrigButtonTop  as single
    Dim sngOrigSubFormTop as single
    Dim sngOrigSubformHeight as single

    'Replace the 3.5, 3.8, and 3.0 in the next three lines with the original values for the controls on the form, before you make changes
    sngOrigButtonTop = 3.5 * 1440
    sngOrigSubformTop = 3.8 * 1440
    sngOrigSubformHeight = 3.0 *1440

    on error goto ProcError

    docmd.Echo Off
    if me.cmd_Resize.Caption = "Increase" then
          'Replace the 1.0 and 1.3 in the following code with the positions where you want the top of the button
          'and the top of the subform when they are expanded.
          me.cmd_Resize.Caption = "Decrease"
          me.cmd_Resize.Top = 1 * 1440      '(1" = 1440 twips)
          me.subformControlName.Top = 1.3 * 1440
          me.subformControlName.Height = sngOrigSubformTop - (1.3 * 1440) + sngOrigSubformHeight
    Else
          me.cmd_Resize.Caption = "Increase"
          me.subformControlName.Height = sngOrigSubformHeight
          me.subformControlname.Top = sngOrigSubformTop
          me.cmd_Resize.Top = sngButtonTop
    End If

ProcExit:
    docmd.Echo true
    Exit Sub

ProcError:
    debug.print "cmd_Resize_Click", err.number, err.description
    msgbox err.number & err.description, , "cmd_Resize_Click
    Resume ProcExit

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
frimyAuthor Commented:
Hi Dale,
yes i tried it ,
it works very good.
i also start using now the Left property.
Thanks and have nice day
0
Dale FyeOwner, Developing Solutions LLCCommented:
glad I could help
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.