can't gotoswitchboard

Mr_Adams

Active Member
Joined
Oct 7, 2002
Messages
475
.
The switchboard I am using was created from the Switchboard manager

On the main Switchboard there is "Admin Switchboard"
when Clicked it will open a password form I created
On this Password form there is the following code
Code:
Private Sub OK_Click()
Dim pwd As String
pwd = [Password]
If pwd = "elpaso" Then
DoCmd.Close acForm, "Password_Check", acSaveNo
DoCmd.SelectObject acForm, "Switchboard", True
    ' Move to the switchboard page that is marked as the Admin.
    Me.Filter = "[ItemNumber] = 0 AND [Argument] = 'Admin' "
    Me.FilterOn = True
    Exit Sub
Else
MsgBox "Access Denied!!!"
DoCmd.Close
DoCmd.SelectObject acForm, "Switchboard", True
End If
End Sub
The problem is that when the user clicks "OK' after entering the
correct password the Main Switchboard is still displayed and I
can't get the Admin Switchboard to show

Any ideas on what I'm doing wrong?

Thank You
.
.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
.
I even tried removing the "Form_open" from the main switchboard code and placing it in the Password form code like so
Code:
Private Sub Form_Open(Cancel As Integer)

DoCmd.Close acForm, "Switchboard", acSaveNo
End Sub
_____________________________________

Sub Admin_Open()

On Error GoTo Admin_Open_Err

    
    DoCmd.OpenForm "Switchboard"
    

    ' Move to the switchboard page that is marked as the Admin.
    Me.Filter = "[SwitchboardID] = 4 AND [Argument] = 'Admin' "
    Me.FilterOn = True

DoCmd.Close acForm, "Password_Check", acSaveNo

Admin_Open_Exit:
    Exit Sub

Admin_Open_Err:
    MsgBox Err.Description
    Resume Admin_Open_Exit
    
End Sub
___________________________________________

Private Sub OK_Click()
Dim pwd As String
pwd = [Password]
If pwd = "elpaso" Then
       Admin_Open
    Exit Sub
Else
MsgBox "Access Denied!!!"
DoCmd.Close
DoCmd.SelectObject acForm, "Switchboard", True
End If
End Sub
This way I could open the Switchboard from the Password form which would allow me to filter on open instead of select.
But the results are the same. Only the Main switchboard is opened.

:rolleyes: Some one PLEASE Help Me
:rolleyes:
 
Upvote 0
Have you tried stepping through your code and checking the value of [password] just prior to the If statement run. From looking at your code, everything seems to make sense, so I would say that the reason it's not running is that for some reason [password] is not equal to elpaso.

Post back if this isn't the case.
 
Upvote 0
Not real certain what your problem is but had some ideas.

Any chance you need to turn on the screen refresh?
DoCmd.Echo = True

Any chance it's the filter interfering with the form opening?
Perhaps maybe turning off screen refresh, opening the form, then setting the filter/echo=true

Have you confirmed that it's processing the code? Set a breakpoint right at the beginning of the code and step thru it to see what it's actually doing. Pay close attention to your Locals window.

Mike
 
Upvote 0

Forum statistics

Threads
1,221,687
Messages
6,161,289
Members
451,695
Latest member
Doug Mize 1024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top