Access Hide all subforms

Get help on databases - MySQL, Oracle, Access, etc.
Post Reply
Mclaren
Registered User
Posts: 497
Joined: 30 Apr 2007, 02:00
Location: c:\program files\temp
Contact:

Access Hide all subforms

Post by Mclaren »

OK, so i have a main form with several subforms on. No data is linked. I have a Command button for each subform which when clicked must either inhide or hide a specific subform. I want each form to only show if i click its corresponding command button. Currently i have to fist click to show a subform then click same command button again to hide said subform before i click another button for another form.

I am looking for a function that can be called from each buttons OnClick event to first check and see if any subforms are visible and if so to hide them beor opening the subform i am currently selecting. I have found many for next loops for controls on the net but none for Subforms. the code i have tried tends to want to close all forms that are visible and not just the subforms that are on the current form.

another solution would be to have the button open a pop up form set to modal, but i want each form to open to a specific size and position on the screen. this i have not managed to do yet.

please can some one help. a solotuion to my first option would be great.
User avatar
Tribble
Registered User
Posts: 88465
Joined: 08 Feb 2007, 02:00
Processor: Intel Core i7-4770K CPU@3.50GHz
Motherboard: ACPI x64-based PC
Graphics card: GeForce GTX 780 Ti
Memory: 16GB
Location: Not here
Contact:

Re: Access Hide all subforms

Post by Tribble »

I will have to think about the rest but a quick fix for the size and position is to use the macros. You use a macro to open the sub forms. You can position each form and control the size. I am sure you can do it in VB too but I cannot give you the code for that offhand.
Image
Mclaren
Registered User
Posts: 497
Joined: 30 Apr 2007, 02:00
Location: c:\program files\temp
Contact:

Re: Access Hide all subforms

Post by Mclaren »

Thanks tribble, I got it right with the macros, my issue is with this way of doing it, the forms stay open. Is there a bit of vb that can check to see if any forms are open and then close them .

EG, on my main form i have several buttons that open each individual form. i am using access 2007 and each button is set so that a hand shows on mouse over, even if the main form is does not have focus. Now, what i want is when i click a button on the main form i need all forms to close other than the main form itself, the open the form i am selecting.

I know i can run vb code that will check each form name and close if open but if i add more forms i have to keep updating the code with new form names.

a schlep.
Post Reply