Button to return to sub-switchboard

djackson

Registered User.
Local time
Today, 09:48
Joined
Apr 20, 2009
Messages
19
OK, i apologise if this has been asked before.
I'm new this forum and couldn't find it anywhere.

I am using a switchboard made with the Switchboard Manager, which has a second switchboard (SwitchboardID 2).

I have buttons on the second switchboard that open up other forms, and then a button on those forms which link back to the main switchboard. My problem is this: i want the buttons on the forms to link back to the SECOND switchboard. As in, the view they were on before they opened the form, not the MAIN switchboard.

I am sure there must be some code i can add that tells the buttons to use the switchboardID = 2 view, but i have no idea what it is.

Any help would be much appreciated.

Dave
 
Just in case my question didn't make sense, this is the bit of code i believe needs altering.

Private Sub Command12_Click()
On Error GoTo Err_Command12_Click
Dim stDocName As String
Dim stLinkCriteria As String
DoCmd.Close
stDocName = "Switchboard"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command12_Click:
Exit Sub
Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub


Where it opens the "Switchboard", i want to somehow tell it to open the switchboard with switchboardID 2.

Again, all help much appreciated
 
The way to do it would be to put a button on your form that uses the standard Docmd.OpenForm "Switchboard" but this time use a filter on the SwitchboardID for example docmd.OpenForm "Switchboard",,,"SwitchboardID = 2"

You will have to close the original Switchboard first before you re-open it.
 
with the standard switchboard you dont need any special button - and certainly dont put anything on a form - the switchboard is still there, just hidden and when you close the form you are in you will see the switchboard on the page you had open before.

you just need another item on the switchboard, to go back to the main menu

the easiest way is to edit the switchboard items table directly. simple once you get the hang of it.

open the switchboard items table

just make one of the buttons on menu 2 return to menu 1

eg, have
switchboard2, item8, command 1, itemtext "return to main menu", command 1, argument 1,

------------------------
the switchboard items table should have this sort of format - among others

command 0 does nothing (title)
command 1 jumps to a menu
command 3 opens a form
command 4 opens a report
command 6 exits the app

PHP:
switchboardid  itemno  itemtext   command argument
1                   0         title for menu 1
1                   1         item1        3          formname
1                   1         item2        1          2  (jump to menu 2)
1                   8         exit           6          close the app
2                   0         title for menu 2
2                   1         item3        3          formname
2                   2         item4        1          5  (jump to menu 5)
2                   8         return       1          1  (jump to menu 1)
 
Hi Dave,

I should have mentioned, i have it set so that when the user opens a form from the switchboard, the switchboard automatically closes. I only want the users to be able to use one screen at a time, hence why I then have buttons on the forms that re-open the switchboard.
The problem is, if they open a form by clicking a button on the second switchboard view, I want them to be able to return to it by clicking a button that reopens the switchboard already in the second view.

And I tried your suggestion Ted but it still isn't working. Is there something i am missing?

Code:
Private Sub Command12_Click()
On Error GoTo Err_Command12_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    DoCmd.Close
    stDocName = "Switchboard"
    DoCmd.OpenForm "Switchboard", , , "SwitchboardID=2"
       
Exit_Command12_Click:
    Exit Sub

Cheers
 
I still haven't found a solution to this problem. I have done extensive google searching, looked through numerous Access manuals, and still nothing.
I really dont want to have to create new forms from scratch instead of using the built in switchboard because my database is almost complete.
I'm sure there must be an easy solution, if anyone can help?
 
For those interested, i found it!

Code:
Private Sub cmdOpenSwitchboard_Click()
On Error GoTo ErrorPoint

DoCmd.OpenForm "Switchboard"
Forms!Switchboard.Filter = "[ItemNumber] = 0 " _
& "And [SwitchboardID] = 2"
Forms!Switchboard.Refresh

ExitPoint:
   Exit Sub

ErrorPoint:
   MsgBox "The following error has occurred:" _
   & vbNewLine & "Error Number: " & Err.Number _
   & vbNewLine & "Error Description: " _
   & Err.Description, vbExclamation, _
   "Unexpected Error"
   Resume ExitPoint

End Sub

http://www.accessmvp.com/JConrad/accessjunkie/switchboardfaq.html

It works perfectly :)
Hope this helps someone else
 
I only want the users to be able to use one screen at a time, hence why I then have buttons on the forms that re-open the switchboard.
The problem is, if they open a form by clicking a button on the second switchboard view, I want them to be able to return to it by clicking a button that reopens the switchboard already in the second view

You select a menu item and it opens a form we will call form1. Now using the unhide property you can hide the switchboard while the user is using form1. The user closes form1 by clicking on say the Close button then in the Close event of the form you set the switchboard property to normal.

Here is some coding for form1 open and close events
switchboard name is the name of your switchboard
acHidden hides the form
acWindowNormal opens the form is in the normal and display the form with the previous display

When form1 is open or activated
Private Sub Form_activate()
DoCmd.OpenForm "switchboard name", acNormal, , , , acHidden

End Sub

Now the user closes form1

Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
'close the current form and open the main menu
DoCmd.Close acForm, "form1"
DoCmd.OpenForm "switchboard name", acNormal, , , , acWindowNormal
Exit_cmdClose_Click:
Exit Sub
Err_cmdClose_Click:
MsgBox Err.Description
Resume Exit_cmdClose_Click

End Sub
 
Cheers Poppa Smurf.

The idea of simply hiding the switchboard never occured to me. I have it set so that it closes completely when a form is opened, and then reopened when the form is closed.
I have actually managed to find a solution that does the job just as well (see above), but i'm sure someone else will find you're solution very useful.

Thank you very much

Dave
 

Users who are viewing this thread

Back
Top Bottom