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
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
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....
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: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
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!
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.