Moving between open forms

Pavl

Registered User.
Local time
Today, 20:24
Joined
Jan 17, 2013
Messages
56
Hello forum from a beginner with accdb 2010.
When multiple forms are open is there a way to move between them without doing a requery or docmd.openform?
I have cmd buttons on each form to allow the DoCmd to open the others but when they are all open I want users to be able to move between forms without changing the status of the destination form.
This will be in a runtime version with every possible restriction so I want to use the form buttons only.
Have tried the following 'onclick' - while putting "rem" on the docmd line to test.

Forms."NameOfForm".TxtControlName.Setfocus = error - expected identifier or bracket.
Forms.[NameOfForm].TxtControlName.SetFocus = error - object doesnt support this property.
Forms.NameOfForm.TxtControlName.SetFocus = works (sets focus to correct control) but the target form remains "behind" the current form.

How can I bring the target form to the front ?
I would like to use something along the lines of -
IfIsLoaded = False Then OpenForm Else SetFocus and bring form to front for the OnClick on each button but do not know how.
 
Last edited:
Thank you for the "bang" advice. But getting the same result = focus is correctly set but the target form remains behind the calling form.

However - have found and tried "BrowseTo" and have got this far -

DoCmd.BrowseTo acBrowseToForm, "NameOfForm", "", "", "", acFormReadOnly

Which does exactly what I want - brings the target form to the front without changing its status.
Sadly this also closes the calling form.
(acNormal does the same thing)

Any ideas how to keep the calling form open - again without requery or a new open so that current status is maintained ?
 
To clarify the problem. I want the function of the tabs at the top of the open forms included within my cmd buttons that open forms (with appropriate If,Else to catch one that is not already loaded). Namely that the top tabs merely move between forms without changing status or closing any form.

Further research indicates that I may need to have the navigation buttons on a subform or have the navigation as the main form and all others as subs - dont know. It seems that all comments and advice talk about the use of BrowseTo in the context of subform navigation.

Any advice appreciated.
 
Thank you Pat.
That seems like a good way to proceed. I was trying to think of a way of reducing the number of forms but that has so far been impossible.

I will use your advice and see if I can make it work.

The db is for the presentation of historical information only so there will be no user input (that is for a later stage). The users need to choose their own route through as there are different combinations of records that could be wanted. Hence the different forms.
 
if a form is set to "popup" it will always be above the others. maybe that is your problem?

obviously "modal" forms get the focus until they are closed, also.
 
Thank you Gemma
Actually it was the suggestion from Pat that has worked for me.
I do not have any modal or popup forms at present - but wish to experiment with them later.
For now I have used the OnClick to check for a form loaded and if it is then to make the calling form not visible, make the target form visible and setfocus to a chosen control.
Have tested this with two forms and can move between the two exactly as I need to.
Another step along the way..........
 

Users who are viewing this thread

Back
Top Bottom