Results 1 to 5 of 5
  1. #1
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69

    Switchboard

    How can I increase the switchboard items to 12 instead of 8? At present I can have only 8 items in a switchboard page. Is there any way to increase it to 12 or more?
    Thanks you

  2. #2
    imintrouble is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Location
    Missouri, where frownin's a sport
    Posts
    127
    I suggest not using the Switchboard Manager, but use form(s) with command buttons to create your Switchboard/Menu system. Creating your menu system this way gives you much more 'power' and flexibility....

  3. #3
    dwaterman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Location
    Elkhart, IN
    Posts
    22
    It has been a while since I did this, but I believe you can accomplish what you want in the VB code. I got to it in design view for the switchboard. Go to properties and click on one of the events. Here is what my code looks like. You will also need to add code in the next section (Private Function HandleButtonClick(intBtn As Integer)) to tell your program what to do when the button is clicked.

    Private Sub FillOptions()
    ' Fill in the options for this switchboard page.

    ' The number of buttons on the form.
    Const conNumButtons = 9

    Dim con As Object
    Dim rs As Object
    Dim stSql As String
    Dim intOption As Integer

    ' Set the focus to the first button on the form,
    ' and then hide all of the buttons on the form
    ' but the first. You can't hide the field with the focus.
    Me![Option1].SetFocus
    For intOption = 2 To conNumButtons
    Me("Option" & intOption).Visible = False
    Me("OptionLabel" & intOption).Visible = False
    Next intOption

    ' Open the table of Switchboard Items, and find
    ' the first item for this Switchboard Page.
    Set con = Application.CurrentProject.Connection
    stSql = "SELECT * FROM [Switchboard Items]"
    stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
    stSql = stSql & " ORDER BY [ItemNumber];"
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open stSql, con, 1 ' 1 = adOpenKeyset

    ' If there are no options for this Switchboard Page,
    ' display a message. Otherwise, fill the page with the items.
    If (rs.EOF) Then
    Me![OptionLabel1].Caption = "There are no items for this switchboard page"
    Else
    While (Not (rs.EOF))
    Me("Option" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
    rs.MoveNext
    Wend
    End If

    ' Close the recordset and the database.
    rs.Close
    Set rs = Nothing
    Set con = Nothing

    End Sub

  4. #4
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69
    Quote Originally Posted by dwaterman View Post
    It has been a while since I did this, but I believe you can accomplish what you want in the VB code. I got to it in design view for the switchboard. Go to properties and click on one of the events. Here is what my code looks like. You will also need to add code in the next section (Private Function HandleButtonClick(intBtn As Integer)) to tell your program what to do when the button is clicked.

    Private Sub FillOptions()
    ' Fill in the options for this switchboard page.

    ' The number of buttons on the form.
    Const conNumButtons = 9

    Dim con As Object
    Dim rs As Object
    Dim stSql As String
    Dim intOption As Integer

    ' Set the focus to the first button on the form,
    ' and then hide all of the buttons on the form
    ' but the first. You can't hide the field with the focus.
    Me![Option1].SetFocus
    For intOption = 2 To conNumButtons
    Me("Option" & intOption).Visible = False
    Me("OptionLabel" & intOption).Visible = False
    Next intOption

    ' Open the table of Switchboard Items, and find
    ' the first item for this Switchboard Page.
    Set con = Application.CurrentProject.Connection
    stSql = "SELECT * FROM [Switchboard Items]"
    stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
    stSql = stSql & " ORDER BY [ItemNumber];"
    Set rs = CreateObject("ADODB.Recordset")
    rs.Open stSql, con, 1 ' 1 = adOpenKeyset

    ' If there are no options for this Switchboard Page,
    ' display a message. Otherwise, fill the page with the items.
    If (rs.EOF) Then
    Me![OptionLabel1].Caption = "There are no items for this switchboard page"
    Else
    While (Not (rs.EOF))
    Me("Option" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
    rs.MoveNext
    Wend
    End If

    ' Close the recordset and the database.
    rs.Close
    Set rs = Nothing
    Set con = Nothing

    End Sub
    Thank you for your reply. As I am novice to VB, could you please clarify the following:

    1. Can I use this code on my existing Switchboard form? Will it add four more items to the list?
    2. Can I use this for 12 Buttons by changing "Const conNumButtons = 12"?
    3. You said "Need to add code in the next section (Private Function HandleButtonClick(IntBtn As Integer))". Where can I find that and how do I add this? I mean where adn to which event?
    4. Can I add the code you have given above, to any of the events in the properties window of Switchboard Form?

    Sorry for giving more trouble.

    Thank you and best regards
    God Bless You!

  5. #5
    dwaterman is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Location
    Elkhart, IN
    Posts
    22
    Check out this site for further instruction. They have pictures that might help. http://www.techonthenet.com/access/s...d/increase.php

    This is to add buttons to your existing switchboard.

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

Similar Threads

  1. Help with second Switchboard
    By Kirsti in forum Forms
    Replies: 0
    Last Post: 02-21-2012, 07:43 PM
  2. Replies: 7
    Last Post: 09-13-2011, 01:38 PM
  3. switchboard like
    By nkuebelbeck in forum Access
    Replies: 1
    Last Post: 06-24-2011, 04:03 PM
  4. Switchboard help? Please
    By MrT1993 in forum Access
    Replies: 13
    Last Post: 02-13-2011, 01:15 PM
  5. Switchboard
    By mwabbe in forum Access
    Replies: 4
    Last Post: 08-26-2010, 07:17 AM

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