Create a table called Users with the following fields
UserID - Autonumber
UName - text
PWord - text
Status - in or out
Create form for your login screen, Include a textbox for Usrname and password and a button saying login
In hte OnClick event of the login button put in the following code
Code:
Private Sub cmdLogin_Click()
Dim strFilter As String, strAdmin As String
Call txtUname.SetFocus
If IsNull(Me.txtUname) Then
MsgBox "Please enter Username and Password", vbCritical, "Login Error"
Exit Sub
End If
Call txtPword.SetFocus
If IsNull(Me.txtPword) Then
MsgBox "Please enter Username and Password", vbCritical, "Login Error"
Exit Sub
End If
strFilter = "(([Uname]='%U') AND ([Pword]='%P'))"
strFilter = Replace(strFilter, "%U", Me.txtUname)
strFilter = Replace(strFilter, "%P", Me.txtPword)
strAdmin = Nz(DLookup("[UserID]", "[Users]", strFilter), "Fail")
If strAdmin = "Fail" Then
lblLoginSuccess.Visible = True
lblLoginSuccess.ForeColor = 255
lblLoginSuccess.Caption = "Incorrect Username or Password"
BMLT.[Form_Navigation Form].navGeneralInformation.Visible = False
BMLT.[Form_Navigation Form].navIncome.Visible = False
BMLT.[Form_Navigation Form].navExpenses.Visible = False
BMLT.[Form_Navigation Form].navRegistration.Visible = False
Else
lblLoginSuccess.Visible = True
lblLoginSuccess.ForeColor = 0
lblLoginSuccess.Caption = "Login Successful"
BMLT.[Form_Navigation Form].navGeneralInformation.Visible = True
BMLT.[Form_Navigation Form].navIncome.Visible = True
BMLT.[Form_Navigation Form].navExpenses.Visible = True
BMLT.[Form_Navigation Form].navRegistration.Visible = True
BMLT.[Form_Navigation Form].Start_Screen.Enabled = False
BMLT.[Form_Navigation Form].navRegistration.SetFocus
SendKeys ("{ENTER}")
'DoCmd.BrowseTo ObjectType:=acBrowseToForm, ObjectName:="Registration"
End If
End Sub
My code will open certain forms based on the users credentials. You'll probably be able to remove some of the code I;ve posted.
Best of luck