Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2008
    Location
    Cardiff
    Posts
    47

    Unanswered: Opening a Table in Switchboard (MS Access)

    Hi Everyone,

    Please would be able to advise me on the following:

    I've just setup a Switchboard to access my Forms which has been successful, however I'm now wanting to access some table's from the Switchboard as well. As I understand it, the switchboard wizard does not let you create an entry for a table automatically, you need to manually add an additional entry within the Switchboard Items Table in 'Table's'. This I have now applied and have also applied additonal code to the Switchboard Form, adding an extra entry for Table within this.

    I am fairly new at this so I'm not sure if if I missed something, but the link does not appear to be working. I'm getting no error, it doesn't do anything. Is my code correct or have I mistyped an entry within my Switchboard Item's table, please could you advise? I've attached all of the code and entries I've made below:

    Many Thanks....


    VB Code:

    Select Case rs![Command]

    ' Go to another switchboard.
    Case conCmdGotoSwitchboard
    Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rs![Argument]

    ' Open a form in Add mode.
    Case conCmdOpenFormAdd
    DoCmd.OpenForm rs![Argument], , , , acAdd

    ' Open a form.
    Case conCmdOpenFormBrowse
    DoCmd.OpenForm rs![Argument]

    ' Open a report.
    Case conCmdOpenReport
    DoCmd.OpenReport rs![Argument], acPreview

    ' Customize the Switchboard.
    Case conCmdCustomizeSwitchboard
    ' Handle the case where the Switchboard Manager
    ' is not installed (e.g. Minimal Install).
    On Error Resume Next
    Application.Run "ACWZMAIN.sbm_Entry"
    If (Err <> 0) Then MsgBox "Command not available."
    On Error GoTo 0
    ' Update the form.
    Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Default' "
    Me.Caption = Nz(Me![ItemText], "")
    FillOptions

    ' Exit the application.
    Case conCmdExitApplication
    CloseCurrentDatabase

    ' Run a macro.
    Case conCmdRunMacro
    DoCmd.RunMacro rs![Argument]

    ' Run code.
    Case conCmdRunCode
    Application.Run rs![Argument]

    ' Open a table.
    Case conCmdOpenTable
    DoCmd.OpenTable rs![Argument], acViewNormal, acEdit


    ' Any other command is unrecognized.
    Case Else
    MsgBox "Unknown option."

    Switchboard Items : Table

    SWBID ItemNumber ItemText Command Argument
    1 0 Main Switchboard Default
    1 1 Customer Information v2.0 3 Customer Index
    1 2 CPMS Track 9 CPMS tracking

  2. #2
    Join Date
    Nov 2008
    Location
    Cardiff
    Posts
    47
    Just to update on this post - I've managed to get this to work however, it only seems to let me link two tables on the switchboard, the third table no matter what I add fails to open.
    Please can anyone confirm whether there's a restriction to allow more than two table's to open successfully?

    Thanks

  3. #3
    Join Date
    Oct 2007
    Location
    Washington D.C.
    Posts
    24
    Boams,

    I can answer your question (without directly answering your question)

    I honestly have never used the switchboard function... Call me hard headed... I have always manually created a main form, and then added all of my buttons individually.

    Say for example you have your main form... just create a button, and then add the following code to the "On Click" event of the button:

    Code:
    Private Sub OpenTable_Click()
    On Error GoTo Err_OpenTable_Click
    
        Dim stDocName As String
     
        stDocName = "tbThisIsYourTableName"
        DoCmd.OpenTable stDocName
    
    Exit_OpenTable_Click:
        Exit Sub
    
    Err_OpenTable_Click:
        MsgBox Err.Description
        Resume Exit_OpenTable_Click
        
    End Sub
    Using this method I am not aware of any limitations on the number of buttons you could put on a form.

    Dean

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    There is no such restriction that I am aware of.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Nov 2008
    Location
    Cardiff
    Posts
    47
    Thanks for support guys, I may just go down the original form route as you say Friz....

  6. #6
    Join Date
    Feb 2004
    Posts
    214

    I would agree with Friz

    Skip the switchboard and manually make your own. This way you get more control over your main menu.
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ▲ Agreed. And the design is simpler too. I hate the Microsoft switchboard solution, it's just way to complicated for what it is.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    The point no one has made is that allowing direct access to a table is a terrible idea! End users should never, never, never be given this ability! Doing this has been cited many, many times as a cause for data corruption. It takes less than a minute to generate a form using the Forms Wizard.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ^^ Agreed... I didn't even notice that was what he was doing
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  10. #10
    Join Date
    Nov 2008
    Location
    Cardiff
    Posts
    47
    Thanks for the advise guys, will convert these into forms then :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •