G
Guest
Can you password protect a particular switchboard item?
Jeff Conrad said:See this page on my site for any and all Switchboard Manager questions:
http://home.bendbroadband.com/conradsystems/accessjunkie/switchboardfaq.html
In your particular case, this specific area:
http://home.bendbroadband.com/conradsystems/accessjunkie/switchboardfaq.html#security
(Watch out for any possible line wrapping on those links)
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
in message:
Private Sub cmdShowAdminArea_Click()
On Error GoTo ErrorPoint
If Me.txtPassword <> "password" Then
'Substitute with your own password between the quotes
MsgBox "Incorrect Password", vbExclamation, "Access Denied"
DoCmd.Close acForm, "frmPassword"
Else
Forms!Switchboard.Filter = "[ItemNumber]=0 And [SwitchboardID]=2"
Forms!Switchboard.Refresh
DoCmd.Close acForm, "frmPassword"
End If
ExitPoint:
End Sub
Jeff Conrad said:in message:
Comment inline.....
Private Sub cmdShowAdminArea_Click()
On Error GoTo ErrorPoint
If Me.txtPassword <> "password" Then
'Substitute with your own password between the quotes
MsgBox "Incorrect Password", vbExclamation, "Access Denied"
DoCmd.Close acForm, "frmPassword"
Else
Forms!Switchboard.Filter = "[ItemNumber]=0 And [SwitchboardID]=2"
Forms!Switchboard.Refresh
DoCmd.Close acForm, "frmPassword"
End If
ExitPoint:
End Sub
The line just above should actually be Exit Sub, not End Sub.
Make the change, compile the code, and then test.
ErrorPoint:
'Unexpected Error
MsgBox "The following error has occured:" & vbNewLine & "Error Number:"
& Err.Number & vbNewLine & "Error Description:" & Err.Description,
vbExclamation, "Unexpected Error"
Resume ExitPoint
End Sub
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
Ok it works now but I have another question. If I leave the password field
blank and click "ok" it allows me to pass through. Is there any way to
eliminate this?
Jeff Conrad said:in message:
Ok it works now but I have another question. If I leave the password field
blank and click "ok" it allows me to pass through. Is there any way to
eliminate this?
Oops, looks like I missed a step!
Change the code to this:
'********Start of new code**********
Private Sub cmdShowAdminArea_Click()
On Error GoTo ErrorPoint
If Len(Nz(Me!txtPassword, "")) = 0 Then
MsgBox "Please enter a password before continuing." _
, vbCritical, "Missing Password"
Me.txtPassword.SetFocus
Else
If Me.txtPassword <> "password" Then
' Substitute with your own password between the quotes
MsgBox "Incorrect Password", vbExclamation, "Access Denied"
DoCmd.Close acForm, "frmPassword"
Else
Forms!Switchboard.Filter = "[ItemNumber] = 0 And [SwitchboardID] = 2"
Forms!Switchboard.Refresh
DoCmd.Close acForm, "frmPassword"
End If
End If
ExitPoint:
Exit Sub
ErrorPoint:
' Unexpected Error
MsgBox "The following error has occurred:" _
& vbNewLine & "Error Number: " & Err.Number _
& vbNewLine & "Error Description: " & Err.Description _
, vbExclamation, "Unexpected Error"
Resume ExitPoint
'********End of new code**********
End Sub
That should do it.
--
Jeff Conrad
Access Junkie - MVP
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
Secret said:Yes I am. Is there another way to create a switchboard?