Navigation Forms - acBrowseToForm v SetFocus (1 Viewer)

VzqCrs

Member
Local time
Today, 10:00
Joined
Nov 15, 2021
Messages
54
I've been searching all over because I know you all hate navigation forms but I have to bite!

I have a form that's already been built and looks like this:

1641479475433.png


Main Navigation Form includes the Edit Details button (among others). While I'm on the Project Details, I want to set focus to the Cost Details tab to activate that form. I've literally used each of the lines below, commenting in/out each line as each failed.

The closest I got was Me.Parent.CostDetails.SetFocus but the error was: can't move the focus to the control....why?

DoCmd.BrowseTo acBrowseToForm, "frmEditWBSDetails", "frmMainNavigationForm.NavigationSubform.NavigationSubform"

Forms!frmMainNavigationForm!NavigationSubform.Form.frmEstimateDetails!frmEditWBSDetails.SetFocus

Me.Parent.CostDetails.frmEditWBSDetails.SetFocus

Forms!frmEditWBSDetails.SetFocus

Forms!frmMainNavigationForm.NavigationSubform.Form!frmEditWBSDetails.SetFocus

Me.Parent.frmEstimateDetails.SetFocus

Me.Parent.NavigationSubform.Form!frmEditWBSDetails.SetFocus

[Forms]![frmMainNavigationForm].[frmNavigationSubForm].[frmEditEstimateDetails]![frmEditWBSDetails].SetFocus
 

Minty

AWF VIP
Local time
Today, 15:00
Joined
Jul 26, 2013
Messages
10,371
A tab control button as such can't receive the focus if you are on another tab, as you would switch to that tab, rather than the one you were on.

Unless I've misunderstood what you are trying to achieve?
If you simply want to mimic pressing the tab then use

MyTabControlName = 2

Which would set the tab control to page index 2
 

VzqCrs

Member
Local time
Today, 10:00
Joined
Nov 15, 2021
Messages
54
would "MyTabControlName be the name of the button, Cost Details? I tried doing that and it didn't work
 

Minty

AWF VIP
Local time
Today, 15:00
Joined
Jul 26, 2013
Messages
10,371
No - it would be the name of your tab control?
Are you saying that your button (cost details) is a separate command button and not part of the tab control?

Perhaps you could show us the form in design view or upload a stripped-down copy of your database, with an idiots guide as to what you are trying to achieve?
 

VzqCrs

Member
Local time
Today, 10:00
Joined
Nov 15, 2021
Messages
54
No - it would be the name of your tab control?
Are you saying that your button (cost details) is a separate command button and not part of the tab control?

Perhaps you could show us the form in design view or upload a stripped-down copy of your database, with an idiots guide as to what you are trying to achieve?
I modified it. Click on Edit Details > Project Details > Status (onChange Event (thinking it should go in BeforeUpdate but...)

When the status is Complete the Cost Details must be entered. How do I navigate to that tab?
 

Attachments

  • ProjectTabs.zip
    381.8 KB · Views: 239

Pat Hartman

Super Moderator
Staff member
Local time
Today, 10:00
Joined
Feb 19, 2002
Messages
43,257
I know you all hate navigation forms but I have to bite!
And you've happened on one of the problems. Only ONE subform is ever loaded at one time so you can never reference a different subform since it is not loaded. The best you can do is set focus to the tab you want to activate as someone else suggested.

I always give my tab controls actual names so I don't have to reference them by number because the number reflects the order in which they were added, NOT the visible order. You may be referencing the tab incorrectly but that is you only option.
 

Users who are viewing this thread

Top Bottom