This is what I do...
I have created a simple login form which loads on start up.
It has a text box for the username (txusername)
a textbox for the password (txpassword)
a button to login
and a button to exit.
When you click the login button, the following code is run:
password = DLookup("Password", "staff", "username='" & txUsername & "' AND password = '" & txPassword & "'")
If password <> "" And IsNull(password) = False Then
DoCmd.OpenForm "Welcome"
Else
MsgBox "Illegal user"
End If
Then on the welcome screen, do the following code for OnLoad:
Private Sub Form_Load()
On Error GoTo Err_Load
username = Forms![Login]![txUsername]
DoCmd.Close acForm, "Login"
Exit_Load:
Exit Sub
Err_Load:
MsgBox Err.Description
DoCmd.Close acForm, "Welcome"
Resume Exit_Load
End Sub