Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Switchboard (97)

    How would I open another database from the switchboard? Is it possible? I know you can use a hyperlink from a command button on a form. Any help would be appreciated. Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Switchboard (97)

    It's possible by creating a function that opens the database. It also requires a little modification of the code behind the switchboard form.

    In a standard module (in the Modules tab of the database window), create a function

    Public Function OpenOtherDatabase(strName As String)
    Application.FollowHyperlink strName
    End Function

    In the Switchboard Manager, create a new item (or edit an existing one). Enter the text you want to be displayed in the first box. In the second box, select the Run Code option. In the third box, enter the function call as you would in Visual Basic, for example

    OpenOtherDatabase("C:My DocumentsMy Database.mdb")

    It won't work yet. The HandleButtonClick function in the code behind the Switchboard form contains a Select Case ... End Case statement to handle the various actions. The bit for the Run Code action is

    Case conCmdRunCode
    Application.Run rst![Argument]

    Unfortunately, you can't pass an argument to a function this way. But there is a way around this: replace Application.Run by Eval:

    Case conCmdRunCode
    Eval rst![Argument]

    Close and save the Switchboard form. Test the new option.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Posts
    1,119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Switchboard (97)

    It won't work. When I get to the part, "in the third box, enter the function call as you would in visual basic," what I have to enter (it is on a network drive: hmpg1015dept0199contractsharerudgereissue.mdb) has too many letters and I can't type the whole string. Help!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Switchboard (97)

    Don't panic.

    Open the Switchboard Items table in design view.
    Click in the last field, Argument.
    In the lower half of the window, increase the Field Size property of this field to something that is large enough to hold your path; 100 should be sufficient.
    Close and save the design of the table.
    Now, you should be able to enter the complete path to your database in the Switchboard Manager (or directly in the table).

Posting Permissions

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