Switchboard

  • Thread starter Thread starter Mike from Moriches
  • Start date Start date
M

Mike from Moriches

Is there a way to go to a specific switchboard page and item (SwitchboardID
and ItemNumber) from code? If so, can you help me with some sample code?
Thanks,
Mike from Moriches
 
Hi Wayne
My switchboard has many pages. One item on the main page, "Lease
Management" goes to a menu of lease management items, lets assume on page
two of the switchboard. When I start up the database, I run a routine that
checks for leases expiring within 10 days, before the main switchboard
displays. If none exist, clicking command button brings up the switchboard,
no problem. if a lease is expiring, I would like a command button to take
me to item 3 on page two of the switchboard, which opens a form pertaining
to leases.
I hope I didn't confuse you. Thanks for your interest.
Mike
 
Instead of trying to open the switchboard and get the item, why not just
open the form directly. Or open the switchboard and then open the form.

If something = False Then
Docmd.OpenForm "Switchboard"
else
Docmd.OpenForm "Switchboard"
Docmd.OpenForm "Name of the form that you open with switchboard"
End if

Doing it with the switchboard is a bit more complex.

To open the switchboard to a specific page you can use the following, where
OpenArgs is the number of the switchboard page.
DoCmd.OpenForm FormName:="Switchboard", OpenArgs:="3"


You also need to modify the code in the switchboard's open event

Dim strSwitchBoardId As String

If IsNull(Me.OpenArgs) Then
strSwitchBoardId = "Default"
Else
strSwitchBoardId = Me.OpenArgs
End If

' Move to the switchboard page that is marked as the default.
Me.Filter = "[ItemNumber] = 0 AND [Argument] = '" & strSwitchBoardId &
"'"
Me.FilterOn = True

Then you need to change the HandleButtonClick from a Private to a Public
procedure so you can call it; Replace twh word Private with the word
Public. Then you can call the handle button click code with
Forms!Switchboard.HandleButtonClick(1)
- for button 1,


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top