Switchboards (1 Viewer)

aneats

Registered User.
Local time
Today, 10:17
Joined
Nov 13, 2002
Messages
70
I have created a switchboard, however i do not want every user to view each of the forms/reports on it, so what i want is something, that when i select a particular form from the switchboard, the user is asked to enter a password, and if they don't know that password, they can't view the form.
i don't want to use access built in security.
would i need to do this at form/ report design level, ie. put some code in 'on click'?
 

DES

Technoweenie
Local time
Today, 05:17
Joined
Apr 17, 2001
Messages
245
Actually it is probably better to have them log in when they get into the program and only allow them access from there.

I have attached a sample of one I use a lot. Any problems let me know.

technoweenie@sympatico.ca
 

ghudson

Registered User.
Local time
Today, 05:17
Joined
Jun 8, 2002
Messages
6,195
It is almost impossible to keep the gremlins out of a login table that holds user names and passwords
unless you are using Access security.

Try my code below if you do not want to use a form and do not mind the simplicity of an input box.
It is designed to be run from the onclick event of a command button on a main form. You could use the code
in the onopen event of a form and have the form close if the user does not key the correct password.

Code:
Private Sub bOpenFormClick_Click()
On Error GoTo Err_bOpenFormClick_Click
    
    Dim strInput As String
    Dim strMsg As String
    
    Beep
    strMsg = "These functions are used only by the special people." & vbCrLf & vbLf & "Please key the Special Form password to allow access."
    strInput = InputBox(Prompt:=strMsg, title:="Special Form Password")
    If strInput = "SpecialPassword" Then 'password is correct
        Beep
        DoCmd.OpenForm "fSpecialForm"
        DoCmd.Close acForm, Me.Name
    Else 'password is incorrect
        Beep
        MsgBox "Incorrect Password!" & vbCrLf & vbLf & "You are not allowed access to the special form.", vbCritical, "Invalid Password"
        Exit Sub
    End If
    
bEdit_Click_Exit:
    Exit Sub
    
Err_bEdit_Click:
    MsgBox Err.Number & " " & Err.Description
    Resume bEdit_Click_Exit
    
Exit_bOpenFormClick_Click:
    Exit Sub
    
Err_bOpenFormClick_Click:
    MsgBox Err.Number & " " & Err.Description
    Resume Exit_bOpenFormClick_Click
    
End Sub
You can not format an input box!

HTH
 

aneats

Registered User.
Local time
Today, 10:17
Joined
Nov 13, 2002
Messages
70
OK, so can i clarify what this does... If i put this code on the 'on open' of my main form (called 'Mandays'), another form will open when i open 'Mandays' that prompts the user for a username and password, and 'Mandays' will open if these are correct?
Maybe i'm wrong.

If i tell you what i'm trying to achieve, then maybe you could help..
I have created a small database, based on the days worked by 6 inspectors. there is also a manager (who the database was created for). ecah month the inspectors enter into the form 'Mandays' figures for the days they have worked for that month. Based on these figures, charts and reports are produced that only the manager should see.
So what i'm after is some kind of form that asks for the username and password, and if it is an inspector using the system, only the form 'Mandays' will be available to them(as this is all they are allowed to see). If it is the manager using the system, i want him to be able to view several Queries, Forms, and Reports.
Do you know how this is possible.

Thanks.
 

VOLLEGAAS

Registered User.
Local time
Today, 10:17
Joined
Feb 3, 2003
Messages
15
DES have you got that same sample but one that is made in Acces 2000? I can't seem to get it working.......
Thanks in advance
 

Mile-O

Back once again...
Local time
Today, 10:17
Joined
Dec 10, 2002
Messages
11,316
ghudson said:
It is almost impossible to keep the gremlins out of a login table that holds user names and passwords unless you are using Access security.

One thing I've done on this is made a small encryption routine that when a user creates their password it stores it in the table as what looks like a jumble of letters and punctuation.

This is relatively simple but it could help.

Code:
Function Entry(ByRef strPassword As String) As String

    Dim strCode As String, intCounter As Integer
    
    For intCounter = 1 To Len(strPassword)
        If intCounter Mod 2 = 0 Then
            strCode = strCode + Chr(Asc(Mid(UCase(strPassword), intCounter, 1)) + 1)
        Else
            strCode = strCode + Chr(Asc(Mid(UCase(strPassword), intCounter, 1)) + 2)
        End If
    Next intCounter
    
    Entry = strCode
    
End Function

Just another idea...
 

freightguy

Registered User.
Local time
Today, 02:17
Joined
Mar 1, 2016
Messages
36
If we were to use GHUDSON's code, would it be possible to use it in the Switchboard menu? I can see this being used if you have a main form but can't see where to place this code anywhere in the switchboard form.
thank you
 

Users who are viewing this thread

Top Bottom