Create a log on form to open on the applications open. The form is a text box to enter a user name and 2 buttons. One to log on and one to exit the application. A table is setup to house user ids and names. Below is the code that executes when a user clicks log on
Private Sub logon_b_Click(
'Check to ensure the user id is valid before continuing
Me.Refresh 'update the underlying recordse
Dim dbs As Databas
Dim switchboard As Recordse
Dim codeset As Recordse
Dim uid
Set dbs = CurrentD
Set switchboard = dbs.OpenRecordset("Switchboard", dbOpenTable
Set codeset = dbs.OpenRecordset("0 username", dbOpenDynaset
Me.Refresh 'update the underlying recordse
uid = Trim(switchboard!user_id
If codeset.EOF = False The
'MsgBox "The user id " & uid & " is ok" 'for testin
DoCmd.OpenForm "Switchboard" 'open the MainBoard for
DoCmd.Close acForm, "Logon", acSaveYes 'close the Logon for
Els
MsgBox "The user id " & uid & " is not valid. Try again
Me.Text2.SetFocus 'goto the user id fiel
End I
End Su