I am not a coder, but I enjoy tinkering.
I have a access database and I have a login screen, but I want to hard code in a high level username and password into the actual code. The username will be "Developer" the password initially will be "One"
This is what I am doing currently. any assistance would be greatly appreciated.
Private Sub cmdLogin_Click()
On Error GoTo cmdLogin_ClickErr
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("Select * From TLKPeople Where Username = '" & Me.txtUserName & "' And Password = '" & Me.txtPassword & "'")
If Not rs.EOF Then
TempVars.Add "UserName", rs!UserName.Value
TempVars.Add "Password", rs!Password.Value
TempVars.Add "Admin", rs!Admin.Value
TempVars.Add "ReadOnly", rs!ReadOnly.Value
TempVars.Add "StdUser", rs!STDUser.Value
If Nz(TempVars!UserName, 0) = "Developer" Then
DoCmd.ShowToolbar "Ribbon", acToolbarYes
End If
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "FRMMenuMain"
DoEvents
Else
MsgBox "Your login as failed!", vbOKOnly, "Login Failed"
End If
rs.Close
Set rs = Nothing
Exit Sub
cmdLogin_ClickErr:
MsgBox ("Err: " & Err.Number & " " & Err.Description)
End Sub