Results 1 to 2 of 2
  1. #1
    fyes is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    1

    Easy question

    I want to control what tabs are visible based on the value in a field "FormName". It's been way too long since I've used VBA.

    Something like this ... using Northwinds as template .... see xxxx's:
    Sub SetFormState(Optional fChangeFocus As Boolean = True)
    If fChangeFocus Then Me.Customer_ID.SetFocus
    xxxx If [FormName] = "PB" Then [Business].Visible = False

    Tab name is [Business]. There will be four values in FormName and about 10 tabs.

    Shawn Fye

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Here is how I do it:
    Code:
    Private Sub ShowTabs()
    With Me
    .tbxSet = TestSet(.tbxLABNUM, "Soils & Aggregate")
    .tab1.Visible = True
    .tab2.Visible = True
    .tab3.Visible = True
    .tab4.Visible = True
    .tab5.Visible = True
    .tab6.Visible = True
    .tbxLABNUM.SetFocus
    If Not .tbxSet Like "*1*" Then
        .tab1.Visible = False
        .ctr1.SourceObject = ""
    End If
    If Not .tbxSet Like "*2*" Then
        .tab2.Visible = False
        .ctr2.SourceObject = ""
    End If
    If Not .tbxSet Like "*3*" Then
        .tab3.Visible = False
        .ctr3.SourceObject = ""
    End If
    If Not .tbxSet Like "*P*" Then
        .tab4.Visible = False
        .ctrProctor.SourceObject = ""
    End If
    If Not .tbxSet Like "*V*" Then
        .tab5.Visible = False
        .ctrVibratory.SourceObject = ""
    Else
        .tab2.Visible = False
    End If
    If Not .tbxSet Like "*H*" Then
        .tab6.Visible = False
    End If
    If .tab1.Visible = True Then
        .tab1.SetFocus
    ElseIf .tab2.Visible = True Then
        .tab2.SetFocus
    ElseIf .tab3.Visible = True Then
        .tab3.SetFocus
    ElseIf .tab4.Visible = True Then
        .tab4.SetFocus
    ElseIf .tab5.Visible = True Then
        .tab5.SetFocus
    ElseIf .tab6.Visible = True Then
        .tab6.SetFocus
    End If
    End With
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Probably a very easy question
    By Ext1jdh in forum Queries
    Replies: 4
    Last Post: 08-02-2011, 12:26 PM
  2. Easy Question Need Help With
    By jdusaf in forum Access
    Replies: 1
    Last Post: 03-23-2011, 11:33 AM
  3. Easy question
    By Danzig in forum Access
    Replies: 11
    Last Post: 10-28-2010, 06:48 PM
  4. Easy newbie question
    By pontuse in forum Access
    Replies: 4
    Last Post: 11-08-2009, 08:02 AM
  5. Easy question...so why can't I figure it out?
    By bdrago527 in forum Access
    Replies: 1
    Last Post: 10-02-2008, 02:40 PM

Tags for this Thread

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