issue regarding password

Dale1992

New member
Local time
Today, 22:31
Joined
Feb 22, 2016
Messages
8
Hello, i am currently creating a database for inspection so logging parts, there is multiple areas that i want only certain people to access for example, the operator can submit the part to be checked without password, but when the inspector completes his form i need it to be password protected, i have the password working fine however i want the inspectors name to get automatically submitted on the following form in a Form field when the password is inputted. i will include below my password VBA code any help would be greatly appreciated. many thanks in advance.:cool: Dale

Private Sub Command102_Click()
'Attached to On Click Event of Command15

Dim strpasswd

strpasswd = InputBox("Enter Password", "Restricted From")

'Check to see if there is any entry made to input box, or if
'Cancel button is pressed. if no entry made then exit sub.

If strpasswd = "" Or strpasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "required Data"
Exit Sub
End If

'If correct password is entered open Editor page
'If incorrect password entered give message and exit sub

'Password Log
'Setter33725 = DJ
'Trebor1961 = RD

If strpasswd = "Setter33725" Or strpasswd = "Trebor1961" Then
DoCmd.OpenForm "Supervisor Sign Off", acNormal
DoCmd.Close acForm, "Main Menu", acSaveYes
Else
MsgBox "sorry, you do not have access to this form (If you have forgotten your password please see D.Jolliffe/R.Topp)", vbOKOnly, "Important Information"
Exit Sub
End If
 
uset tempvars to hold your password. the code below uses Tempvar("UserUser"), you can name name it to others, ie: Tempvars("LoginUser"), etc.

Private Sub Command102_Click()
'Attached to On Click Event of Command15

Dim strpasswd

If IsNull(TempVars("SuperUser")) Then Tempvars.Add "SuperUser", ""
strpasswd = InputBox("Enter Password", "Restricted From", Tempvars("SuperUser"))

'Check to see if there is any entry made to input box, or if
'Cancel button is pressed. if no entry made then exit sub.

If strpasswd = "" Or strpasswd = Empty Then
MsgBox "No Input Provided", vbInformation, "required Data"
Exit Sub
End If

'If correct password is entered open Editor page
'If incorrect password entered give message and exit sub

'Password Log
'Setter33725 = DJ
'Trebor1961 = RD

If strpasswd = "Setter33725" Or strpasswd = "Trebor1961" Then
Tempvars("SuperUser") = strpasswd
DoCmd.OpenForm "Supervisor Sign Off", acNormal
DoCmd.Close acForm, "Main Menu", acSaveYes
Else
Tempvars("SuperUser") = ""
MsgBox "sorry, you do not have access to this form (If you have forgotten your password please see D.Jolliffe/R.Topp)", vbOKOnly, "Important Information"
Exit Sub
End If
 
hello, thank you for the replies, i am struggling to get it to work. i basically atm have a button that when pressed prompts a password from the user, i have added 2 users desired passwords into this. The problem i have is when the correct password is entered and the form opens, the user completes the necessary fields but i have a combobox to input name, they could select someone elses name and click save. i need a way for example the password "Crankshaft" is inputted then it automatically puts the linked name for example "Dale" in the box on the following page. If the next user with the password "hydro" was imputted it puts "Craig" in the box instead. Is there a way of doing this? i am reletively new too access. kind regards
 
Also i do not have log ins for individual users, they just have a password which they input, and i have put in the code strpassword "example1" or "Example2". So only the set users passwords are accepted. would it be easier if i uploaded my database or screenshots of what i require?
 

Users who are viewing this thread

Back
Top Bottom