Setting the Focus to a Navigation Sub Form

Paul Cooke

Registered User.
Local time
Today, 16:23
Joined
Oct 12, 2001
Messages
288
Hi Guys - seems ages since I was last on here but am back to finishing off my DB and need some advice again !!

I have a Access Navigation form, with subforms within each 'button' one of these buttons is called 'Treatment Menu' (NavigationButton19)

On the 'Treatment Menu' subform (called 'NavigationSubform' by default) I have some cmd buttons to open the relevant user forms. when any of the buttons are clicked the relevent user form opens and the Navigation form closes.

On the current open user form I have put in a cmd button called 'Return' - which is where the problem is...

Is there a way I can return to the Navigation form to the same point that I came from - in this case the 'Treatment Menu' subform?

I have tried using Docmd and Forms! ect ect but nothing seems to be working!

And advice greatly recieved !!

Many thanks
 
Just about every visible element in access exposes a .SetFocus method. So to set the focus to a control, do something like ...
Code:
Me.MySubformControl.Setfocus
 
Thanks For the reply,

The problem I have using 'me' would not work here as its the navigation forms I asking the code to open.. So I tried using Forms!Navigation ect but this did not work either.

When looking at the Navigation Area all of the subforms are called "NavigationSubform" (although the actual forms have different names in the Access Object tree)

So in my case the form I am trying to go to via the cmd button is the NavigateTreatment form. If I use...
Code:
docmd.openform "NavigateTreatment"
Only this subform would open not the Navgation area.

I cant use..
Code:
Docmd.openform "NavigationSubForm"
Because all of the Navigation area's subforms are called "NavigationSubForm" by default.

I am not sure I am explaining this very well - sorry but hopefully it makes sense !!
 
Why not just make the "Navigation Subform" Invisible (if it's a subform) or hidden (if it's a main form)

Then when you close the "user form" you can unhide the main form or make visible the sub form.
 
Good point ! Unfortuntately Im so far int the design of the DB it would mean changing a hell of a lot of code for it work (with all the other permatations used by the Navigation form).

Surely there must be a way to go back to the form - Anyone??

thanks
 
I think that if Thales750's idea doesn't seem like a good one to you then maybe I don't understand what you are trying to do. You want to make something disappear and then reappear again?
For the sake of possibly making some things more clear: A form can contain a subform, but that subform is in a control, and that control is more akin to a textbox than to a form. So to reference the subform you name the parent form, then the subform control, then the subform...
Code:
Me.MySubformControl.Form
This returns a reference to the subform. You can change the subform by changing the SourceObject property of the subform control...
Code:
Me.MySubformControl.SourceObject = "NavigationSubform"
Hope this helps,
Mark
 
Hi Mark,

Thanks for the reply

I have looked at this all afternoon and did go back to change the code as suggested by 'Thales' so my issue is resolved but in reply to your response the problem with the subforms of the Navigation area is that they are all called "NavigationSubForm" so you can't code to a specific one or at least I don't think you can or more likely I am not understanding it !!

Thanks all for the repllies though - progress is progress !!
 
Not sure exactly what you mean, but a subform control can host any form. Just change the SourceObject property of the Subform control and the old form will close and the new form will open all inside the subform control on the parent.
But glad you got it working,
Mark
 

Users who are viewing this thread

Back
Top Bottom