I know there are a whole bunch of threads about this and I feel like I have checked them all. I have a Log in to start the database now the code is below, however I want the user when he/she logs on only to see their own record (which contains their user name and password) and nothing else in the database similar to a bank log on on the web and you see all your stuff but not every client the bank has. if I do this in a query the user can see only their account but can't edit it Is this possible, or am I a complete idiot Private Sub cmdEnter_Click()
'Check to see if data entered into the UserName combo box
If IsNull(Me.cmbUserName) Or Me.cmbUserName = "" Then
MsgBox "You must select a User Name.", vbOKOnly, "Required Data"
Me.cmbUserName.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password text box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a valid password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in the tblLogin to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "tblUser", _
"[UserID]=" & Me.cmbUserName.Value) Then
MyEmpID = Me.cmbUserName.Value
'Close logon form and open navigation screen
DoCmd.Close acForm, "frmLogin", acSaveNo
DoCmd.OpenForm "000Navigationfrm"
Else
MsgBox "Password invalid. Please try again.", vbOKOnly, _
"Invalid Entry"
Me.txtPassword.SetFocus
End If
'If User enters incorrect password 3 times database will close
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact the administrator.", _
vbCritical, "Restricted Access"
Application.Quit
End If
End Sub