switchboard to login form to next switchboard

L

LGarcia

Hi all,
I have a switchboard item named Manager's Menu that opens another
switchboard. I'd like to redo this so that the managers menu button goes to
a login form first and if crtieria is met will open the manager's menu
switchboard. Otherwise it will return an error message and then return to
the previous switchboard. Is this possible using the switchboard manager or
will I have to create my own form for my manager's menu switchboard?
TIA,
LGarcia
 
J

Jeff Conrad

When you start getting into this level of complexity it may be time to start thinking about building
your own type of Switchboard/Main Menu interface. The built-in SBM can be quite limiting for this
type of thing.

However, this can be done using the SBM. I'll provide the structure for a solution, but you'll need
to fill in the blanks.

1. On the SBM use the option to open your "login" form instead of opening the Manager's Menu.

2. On the login form use code (something like this) for a command button that verifies the user and
opens the Manager's Menu:

Private Sub cmdLogin_Click()
On Error GoTo ErrorPoint

' Code here to validate the user somehow
' If successful, display Manager Menu and close the login form

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

' If not validated, skip that part above and display a message
' Close the login form if desired

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

What this will do is open the Switchboard form (if not already), but display the second menu. If the
Manager's Menu is NOT SwitchboardID number 2 in the Switchboard Items TABLE, just find out what the
number is and change the code to the correct number. Also, this code assumes you haven't changed the
name of the actual Switchboard form. Adjust the code if necessary for that.
 
L

LGarcia

Thanks! This will do it!
LGarcia

Jeff Conrad said:
When you start getting into this level of complexity it may be time to start thinking about building
your own type of Switchboard/Main Menu interface. The built-in SBM can be quite limiting for this
type of thing.

However, this can be done using the SBM. I'll provide the structure for a solution, but you'll need
to fill in the blanks.

1. On the SBM use the option to open your "login" form instead of opening the Manager's Menu.

2. On the login form use code (something like this) for a command button that verifies the user and
opens the Manager's Menu:

Private Sub cmdLogin_Click()
On Error GoTo ErrorPoint

' Code here to validate the user somehow
' If successful, display Manager Menu and close the login form

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

' If not validated, skip that part above and display a message
' Close the login form if desired

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

What this will do is open the Switchboard form (if not already), but
display the second menu. If the
Manager's Menu is NOT SwitchboardID number 2 in the Switchboard Items TABLE, just find out what the
number is and change the code to the correct number. Also, this code
assumes you haven't changed the
 
J

Jeff Conrad

You're welcome, glad to help.

--
Jeff Conrad
Access Junkie
Bend, Oregon

LGarcia said:
Thanks! This will do it!
LGarcia

Jeff Conrad said:
When you start getting into this level of complexity it may be time to start thinking about building
your own type of Switchboard/Main Menu interface. The built-in SBM can be quite limiting for this
type of thing.

However, this can be done using the SBM. I'll provide the structure for a solution, but you'll need
to fill in the blanks.

1. On the SBM use the option to open your "login" form instead of opening the Manager's Menu.

2. On the login form use code (something like this) for a command button that verifies the user and
opens the Manager's Menu:

Private Sub cmdLogin_Click()
On Error GoTo ErrorPoint

' Code here to validate the user somehow
' If successful, display Manager Menu and close the login form

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

' If not validated, skip that part above and display a message
' Close the login form if desired

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

What this will do is open the Switchboard form (if not already), but
display the second menu. If the
Manager's Menu is NOT SwitchboardID number 2 in the Switchboard Items TABLE, just find out what the
number is and change the code to the correct number. Also, this code
assumes you haven't changed the
name of the actual Switchboard form. Adjust the code if necessary for that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top