Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

revealing hidden part of a form

Status
Not open for further replies.

IRTFM

MIS
Oct 10, 2004
5
US
I am pretty new to VBA and I am trying to figure out how to reveal a hidden section of a form. Here is the explaination...

I have a textbox in the header section of a form that accepts an entry and a command button that places the value of that input into a query that populates the rest of the form controls based on the input. I hide the detailed area of the form with these textboxes in it and unhide them when the command button is clicked. I left the forms resize property enabled so only the header shows when it originally opens then when the command button is clicked I want it to resize to the full form with the query results in the detailed area.

My problem is that the header shows just like I want it but when I click the command button the detailed area is enabled but the form does not resize to show the information. How would I resize the form using code or any other method for that matter. Any help will be greatly appreciated.

Thanks,

 
Hi,
Did you try DoCmd.MoveSize Height,Down,Width,Height
Sonething like this
Code:
Private Sub CommandButton_Click()
DoCmd.MoveSize , , 200,300
End Sub
omitted right and down properties to keep the form at the palce where it is. or add something ther to move the form to desired location.
regards

Zameer Abdulla
 
I tried that and it gave me some funky results where there was half a form, a form on the corner of the screen....etc. I have tried different ways to use this DoCmd method. The only way I can get close to what I want is by leaving the form's resize property to false but that just gives me a big empty form until I fill it with info and reveal the controls in that section.

I just wanted to make one the form work as two so that it would reduce the amount of objects that the app already has. I have been cleaning up this app that the prior Net admin had created. I have been learning VBA along with it and it has been a pretty good challenge. Nothting like jumping right into the fire and skipping the frying pan. Well, any other suggestions? Any would be appreciated....

Thanks
 
Change your form settings to
Code:
Private Sub Form_Open(Cancel As Integer)
DoCmd.MoveSize , , , 1500
End Sub

Code:
Private Sub CommandButton_Click()
DoCmd.MoveSize , , ,5000
End Sub

This will open the form only with the header visible(However you have to change the pixel size according to your form's header size which in this case is 1500)
It will resize to tall size when you click the button.
HTH


Zameer Abdulla
 
I tried that that for a while now and it works great. Thanks a bunch! I just had to get the hange of using the Movesize method. Sorry for the stubborness, guess somethings I learn the hard way. Story of my life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top