Results 1 to 2 of 2
  1. #1
    trevor40's Avatar
    trevor40 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    407

    Cool Selecte TAB page using VBA

    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

  2. #2
    trevor40's Avatar
    trevor40 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2014
    Location
    Australia
    Posts
    407
    I posted too soon, I found it.

    Me.main_menu_tab.Pages(0).SetFocus

    Select Case .Pages(.Value).Caption
    looked at the above line and saw the it in front of me!
    I'll think about it for 1min before posting next time.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Report with page break appears with a blank page, why?
    By clebergyn in forum Programming
    Replies: 4
    Last Post: 02-24-2014, 12:32 PM
  2. Replies: 1
    Last Post: 03-05-2013, 06:38 PM
  3. Replies: 1
    Last Post: 11-21-2012, 08:18 AM
  4. Page break on report inserts empty page between
    By Galadrielle in forum Reports
    Replies: 0
    Last Post: 07-07-2010, 04:18 AM
  5. Replies: 0
    Last Post: 02-11-2009, 06:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums