Goto Tab

Gismo

Registered User.
Local time
Today, 10:38
Joined
Jun 12, 2017
Messages
1,298
Hi, Please could you assist in correct code as below?
I have a tab control called Criteria and a tab called Parts (page 1).
After a combo box have been selected the form must open on the Parts tab but the form opens on the first tab (0) which is not the wanted tab

Code:
Private Sub PartCategory_AfterUpdate()
DoCmd.Close acForm, "New Entry - Spares", acSaveYes
DoCmd.OpenForm "New Entry - Spares"
Me.Criteria.Pages.Item("Parts").SetFocus

End Sub
 
Code:
Its very simple. If Parts is the tab name (not its caption), use

Code:
Me.Parts.SetFocus

Make sure there are no other controls with that name on the form

EDIT:
If you are closing the form & reopening it, you need to combine with open args code (or similar)

BUT why are you closing and reopening the form?
If you are just trying to force a save do the following instead:

Code:
Private Sub PartCategory_AfterUpdate()
If Me.Dirty Then Me.Dirty=False
Me.Parts.SetFocus

End Sub
 
Last edited:
Parts is the Tab name yes, not the Caption. i used the code as you suggested as well but the form opens on "tab 0" and not "tab 1" which is Parts
 
I had to close the form after update as the combo selection updates a subform on the main form which i could not get to refresh so i closed and opened the form.
 
I managed to get it working, thank you
 

Users who are viewing this thread

Back
Top Bottom