Question switchboard problem (1 Viewer)

mikeymoon2

New member
Local time
Today, 22:15
Joined
Dec 18, 2008
Messages
1
I am building a switchboard to run a simple Access database. The main page has two options: GENERAL and ADMIN. Clicking on GENERAL opens another page with a series of buttons to open various forms etc. and is not a problem. But when I click on ADMIN I want to go first to a blank form (not a switchboard page) with a password box. Entering the correct password should then go back to another switchboard page (OPTIONS) with various admin options. The problem is that the macro on the blank form takes me back to the main page of the switchboard (default) and not to the OPTIONS page. I have tried changing the code in the macro to the switchboard ID/ Item/ Argument for the OPTIONS page as shown in the table of switchboard items, but I get a warning that the macro can only run 20 times and that I need to set a condition limiting that number of times. Am I missing something simple about directing the macro to open OPTIONS (and not the default first page) and/or how do I set a condition to run the macro only once (assuming it is going to work)? Thanks for your help!
 

ezfriend

Registered User.
Local time
Today, 14:15
Joined
Nov 24, 2006
Messages
242
Here is what I did for a small app that I have. The is a modification of the Asset Tracking database.

in the Switch Board module, I implement the following.

Code:
Private Function HandleButtonClick(intBtn As Integer)
........

    Select Case rs![Command]
        
        ' Go to another switchboard.
        Case conCmdGotoSwitchboard
        
            If rs![Argument] = 2 Then
            
                DoCmd.OpenForm "frmLogin", , , , , acDialog
                
                With Form_frmLogin
                
                    bValidUser = .ValidUser
                    
                End With
                
                DoCmd.Close acForm, "frmLogin"
                
                If bValidUser = True Then
                    Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rs![Argument]
                Else
                    MsgBox "INVALID PASSWORD"
                End If
                
            Else
                Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rs![Argument]
            
            End If

'case ....

'......
End select

End Function

In the Login form (frmLogin), implement the code below.
frmLogin has one text box text0 and a command button
Code:
Option Compare Database
Private m_bValidUser As Boolean

Public Property Get ValidUser() As Boolean
    ValidUser = m_bValidUser
End Property

Private Sub Command0_Click()

    'this is for testing purpose, but you might want to use other error handling here.
    If Text0 = "admin" Then
        m_bValidUser = True
    Else
        m_bValidUser = False
    End If
    
    Me.Visible = False
    
End Sub
 

Users who are viewing this thread

Top Bottom