1. you need to create a table say Security with minimum 3 fields.
a. UserId Number/Text (Key Field)
b. UseName Text(50)
c. Password Text(50)
If you want you can add any other Info Like Secuty Level etc...
2.In CmdOk Click Event you need to write a SQL Statement like
Dim Curdb As Database, SQLStmt As String, SecTB As Recordset
Set Curdb = CurrentDb() 'If your table and form are in same database other wise change it
SQLStmt = "SELECT * FROM [Security] WHERE [UserName] = '" & Trim("" & Me![txtUserName]) & "'"
SQLStmt = SQLStmt & " [Password] = '" & Trim("" & Me![txtPassword]) & "'"
Set SecTB = Curdb.OpenRecordset(SQLStmt, DB_OPEN_DYNASET)
If SecTB.EOF Then
MsgBox "Logon ID or Password not found!", 16, "Incorrect Logon Information"
SecTB.Close
Exit Sub
End If
SecTB.Close
DoCmd.OpenForm "Detail Form" Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need!