Sub-switchboard

D

Dino

I have a switchboard that has several buttons on it. I would like one of the
buttons to open up another switchboard with a few more buttons on it. How do
I do that?
 
F

fredg

I have a switchboard that has several buttons on it. I would like one of the
buttons to open up another switchboard with a few more buttons on it. How do
I do that?

It depends.
Is this switchboard one created by the built-in Access Switchboard
Manager.?
Open the manager. Create a New item. One of the button action choices
is Go to Switchboard. Enter this new item name.
Continue adding new actions as needed. Save the changes.

If this is an unbound Switchboard form that you created yourself,
create another unbound form. Add command buttons as needed.
Add a new command button to the original switchboard.
Code it's Click event:
DoCmd.OpenForm "NewSwitchboardFormName"
 
D

Dino

It is the one created by the switchboard manager. I followed your
instructions, and it worked great, except that each page has the same name as
the first page even though I named them differently.

When you click a button and go to a sub-menu, how do you go back a page?
Right now, I have to close the switchboard and start over.
 
F

fredg

It is the one created by the switchboard manager. I followed your
instructions, and it worked great, except that each page has the same name as
the first page even though I named them differently.

When you click a button and go to a sub-menu, how do you go back a page?
Right now, I have to close the switchboard and start over.

1) You can make changes in the coding of the switchboard to identify
which switchboard menu is active and change it's label accordingly.

You have to identify the current SwitchboardID in the
Sub FillOptions()
and then change the label captions according to the ItemText value.

Here is an example of the changes to the Sub FillOptions() that
will change the label caption according to which menu page is active.
The caption will change to whatever you have named that menu page.

Open the switchboard's code window and find the Sub FillOptions Sub.
Drop down a bit further until you come to

If (rst.EOF) Then

Change the code from that line to the end of that Sub so that it looks
like this:
(Watch out for improper message text wrapping.)

If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this
switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
Label1.Caption = Me.ItemText
Label2.Caption = Me.ItemText
End If

' Close the recordset and the database.
rst.Close
Set rst = Nothing
Set con = Nothing
End If
===========

As far as going back to the first page menu, add another item to the
second switchboard, using the manager, to Go to SwitchBoard and enter
the first page name.

This is a Switchboard created by the Switchboard Manager is a
complicated method for what is really an easy problem.
You would be far better off creating your own switchboard(s) using
unfound forms. Add whatever command buttons you need. If you use the
Command Button wizard, Access will write most of the code for you. You
will have more control over what the switchboard will do, how it will
look, and maintenance will be much easier.
 
D

Dino

Thanks, it worked great!

fredg said:
It is the one created by the switchboard manager. I followed your
instructions, and it worked great, except that each page has the same name as
the first page even though I named them differently.

When you click a button and go to a sub-menu, how do you go back a page?
Right now, I have to close the switchboard and start over.

1) You can make changes in the coding of the switchboard to identify
which switchboard menu is active and change it's label accordingly.

You have to identify the current SwitchboardID in the
Sub FillOptions()
and then change the label captions according to the ItemText value.

Here is an example of the changes to the Sub FillOptions() that
will change the label caption according to which menu page is active.
The caption will change to whatever you have named that menu page.

Open the switchboard's code window and find the Sub FillOptions Sub.
Drop down a bit further until you come to

If (rst.EOF) Then

Change the code from that line to the end of that Sub so that it looks
like this:
(Watch out for improper message text wrapping.)

If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this
switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
Label1.Caption = Me.ItemText
Label2.Caption = Me.ItemText
End If

' Close the recordset and the database.
rst.Close
Set rst = Nothing
Set con = Nothing
End If
===========

As far as going back to the first page menu, add another item to the
second switchboard, using the manager, to Go to SwitchBoard and enter
the first page name.

This is a Switchboard created by the Switchboard Manager is a
complicated method for what is really an easy problem.
You would be far better off creating your own switchboard(s) using
unfound forms. Add whatever command buttons you need. If you use the
Command Button wizard, Access will write most of the code for you. You
will have more control over what the switchboard will do, how it will
look, and maintenance will be much easier.
 
Top