Hi all, I'm trying to use vba to move focus to tab page 0.
I was using the code below, but had to change some things. previously the code would put you back were you came from if the password is wrong. This worked until I had to move an option group from 4 pages and replace it with one on the form (Frame1296). It all works unless the previous control was one of the option buttons of this frame. I've tried testing this by setting the option group to visible, and not changing it. It will return to any of the controls on seperate pages of the tab control, but not the option group controls. the option group is set in front of the tab menu. When i try It says cannot move focus to the control toggle1299 (option group button).
if I can select the TAB page to return to, in stead of Screen.PreviousControl, I will direct it to the starting tab page index 0
Private Sub main_menu_tab_Change()
With Me(contabs)
Select Case .Pages(.Value).Caption
Case "S&ystem"
Me.Frame1296.Visible = False
Me.Company_Details.Visible = False
Me.Setup_Options.Visible = False
'On Error GoTo stopt
If InputBox("Enter Password", "PW Check") = "1234" Then
Me.Company_Details.Visible = True
Me.Setup_Options.Visible = True
Me.Setup_Options.SetFocus
Me.pwcheck.Visible = False
Else
Me.Frame1296.Visible = True
Screen.PreviousControl.SetFocus ' problem returning to frame1296
Exit Sub
End If
Case "Consignment &Track"
Me.Frame1296.Visible = False
Case "&History", "Courier&s", "Custo&mers", "&Employee's"
Me.Frame1296.Visible = True
End Select
End With
End Sub