If (Err 0) Then MsgBox "Command not available." ' is not installed (e.g. Minimal Install). ' Handle the case where the Switchboard Manager MsgBox "There was an error reading the Switchboard Items table." ' If no item matches, report the error and exit the function. ' that corresponds to the button that was clicked. ' Find the item in the Switchboard Items table
![ms access switchboards ms access switchboards](https://2.bp.blogspot.com/-4yWhpyyss_Y/WQMf_q7g1sI/AAAAAAAABlo/3Qt2pE0dFlAzGH5rElBFD4yYkrajdQH5wCLcB/s1600/select%2BSwitchboard%2Bfrom%2Bthe%2Bdrop%2Bdown%2Blist%2Band%2Bclick%2Bok.png)
' Constants for the commands that can be executed. ' intBtn indicates which button was clicked. ' This function is called when a button is clicked. Private Function HandleButtonClick(intBtn As Integer) ' it's defined in the Argument field in the table ' to carry out the action associated with that button as ' This function accepts the user's selection and attempts Me("OptionLabel" & rs!).FontItalic = False Me("OptionLabel" & rs!).FontItalic = TrueĮlseIf Me("OptionLabel" & rs!).Caption = "&Return to Main" ThenĮlseIf Me("OptionLabel" & rs!).Caption = "E&xit Application" Then If Me("OptionLabel" & rs!).Caption = "&Previous Menu" Then Me!.Caption = "There are no items for this switchboard page" ' If there are no options for this Switchboard Page, StSql = "SELECT * FROM " & strSwitchboardVersion ' the first item for this Switchboard Page. ' Open the table of Switchboard Items, and find Me("OptionLabel" & intOption).Visible = False ' and then hide all of the buttons on the form ' Set the focus to the first button on the form, 'Determine the correct Switchboard table to use ' Fill in the options for this switchboard page. ' name of the item to the associated button on the form ' that match the current switchboard ID and outputs the ' This subroutine loops through the items in the table ' Update the caption and fill in the list of options. ' switchboard to the related item in the table and calls ' This subroutine sets the caption of the current ' Move to the switchboard page that is marked as the default. ' Minimize the database window and initialize the form. ' This subroutine sets the Switchboard to the default Me.RecordSource = "Switchboard Items - Reports" Me.RecordSource = "Switchboard Items - OSC" Me.RecordSource = "Switchboard Items - Auditor" ' user role and sets the record source to the correct table ' This subroutine changes the color based on the active
MS ACCESS SWITCHBOARDS CODE
Here's my code (the login form sets the strGlobalUserRole variable and this variable is used to determine the correct table to use as the record source): I know I could create two more forms so that there's one form for each table of Switchboard items and add some code to the login form to direct the user to the correct Switchboard form, but I'd really like to get this to work so I don't have to create new forms. I tried creating a new Switchboard and the items that were set to direct the user to another Switchboard menu worked just fine, but stopped working once I tried to introduce a variable record source.
![ms access switchboards ms access switchboards](http://www.databasedev.co.uk/image/po_all_switchboards.jpg)
I don't know why this would work in 2003 and won't work in 2010. However, when I click on any of the other handle buttons that have code associated with them to perform a function, they work just fine. When I opened the database using Access 2010, the Switchboard would do nothing when I would click on a handle button that was set to open another Switchboard menu. For the past 4 years, this has worked like a charm.
![ms access switchboards ms access switchboards](https://www.siue.edu/~joemoor/images/west9-2.gif)
All in all, I added maybe 10 lines of code to the stock Switchboard code and modified another 3-4 lines. Then, I went into the code behind the Switchbaord form, added code to determine the logged in user's user role, and modified it to set the record source of the Switchboard form to the correct table. So, I created a Switchboard using the Switchboard Manager, then copied the table twice, and modified the contents accordingly for the three user roles. In the 2003 version, I needed a Switchboard that could handle different user roles and display different options on the Switchboard based on the logged in user (using a simple login form). I'm familiar with a number of areas in 2003 that have to be modified to work in 2010, but my issue today is not something I would have thought would cause problems. mdb format for the time being, so I'm not performing a true conversion.just trying to get it to work in the new version. I've got a database that was created in Access 2003 that I've opened in Access 2010. My title may not exactly describe my issue, so please forgive my lack of creativity today.