My Assistant
![]() ![]() |
|
|
Dec 8 2006, 10:57 AM
Post
#1
|
|
|
UtterAccess Ruler Posts: 1,658 |
I have a form with a button that opens another form and hides the first form. The custom menu bar "close" option will not work for the second form. Reading the help, if you dont specify which form to close, it "will close the active form". Apparently, to the macro the menu bar is made from, it thinks the hidden form (form1) is still the active one. How can I change this to the second form?
|
|
|
|
Dec 8 2006, 11:41 AM
Post
#2
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
DoCmd.Close acForm, "NameOfFormToClose"
|
|
|
|
Dec 8 2006, 12:06 PM
Post
#3
|
|
|
UtterAccess Ruler Posts: 1,658 |
I want the custom menu to be universal so i dont have to keep making new custom menus so everytime a new form is open, a new menu bar has to be associated with it. That is why I don't want to specify which form to close....
|
|
|
|
Dec 8 2006, 12:32 PM
Post
#4
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
If you don't specify a form how will Access know which one to close? How about closing the form when you open the new one instead of just hiding it? I do not know if something like this will work as I have not tried it:
Dim frm As Form Dim a As Integer For a = 1 To Forms.Count + 1 For Each frm In Forms If frm = screen.activeform Then 'do nothing Else DoCmd.Close acForm, frm.Name End If Next frm Next a Jack |
|
|
|
Dec 8 2006, 12:37 PM
Post
#5
|
|
|
UtterAccess Ruler Posts: 1,658 |
Thanks Jack, I will try your code later.
Let me ask though...is there any benefits to hiding vs closing? Assuming there is not a lot going on when a form is closed/opened.... |
|
|
|
Dec 8 2006, 12:58 PM
Post
#6
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
I am not aware of any benefit of hiding vs closing unless there is a TON of stuff going on with the form and it takes some time to load. In that case hiding is obviously better then closing...
hth, Jack |
|
|
|
Dec 8 2006, 01:21 PM
Post
#7
|
|
|
UtterAccess Ruler Posts: 1,658 |
Thanks, that is what i was thinking.
|
|
|
|
Dec 8 2006, 01:50 PM
Post
#8
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
You are welcome... What a lot of us do is have all our forms open maximized. A new form is then opened and covers the previous form. When the current form is closed the previous form is displayed, which is generally the form you want to see. This way most forms stay open all the time but are unseen as they are behind the current form.
Good luck with this! Jack |
|
|
|
Dec 9 2006, 10:38 AM
Post
#9
|
|
|
UtterAccess Ruler Posts: 1,658 |
Jack, the reason I want to keep other forms on top of the previous forms is because they are small. IMO, they would look stupid with the screen maximized, and then I would have to worry about multiple resolutions.
Look at my attachement and you will get a better idea. I would like the form that is the last to be open (on top) the one to be able to use the menu bar to print, etc. I can't get that to work right now, especially when a report is opened to preview. Thanks.
Attached File(s)
|
|
|
|
Dec 9 2006, 11:53 AM
Post
#10
|
|
|
Retired Moderator Posts: 37,716 From: The San Francisco Bay Area |
TOD -
I don't quit understand your question, but if your top form is opened as Pop Up and Modal then you can't click on anything until that form is closed. Does that help? Also, I am off to another job shortly and I will not be back in the UA building until tomorrow. If we get rained out today I may be back this afternoon, but don't count on that.... Jack |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th June 2013 - 05:12 PM |