You can do this if you have some type of procedure to connect to the data
base. rsAdministrator is the table where your username and password are
stored.
Sub procLogin(UserName As String, PassWord As String)
' variable for a database connection
Dim dbsConnection As Database
'variable for a recordset object
Dim rsAdministrator As Recordset
Dim sqlString As String
' Connect to database by calling a module function.
Set dbsConnection = procConnectToDatabase()
' 1.4 Validate UserName, Password
sqlString = "SELECT tblAdministrator.*" & _
" FROM tblAdministrator" & _
" WHERE ((tblAdministrator.UserName)='" & UserName & "'
AND((tblAdministrator.Password)='" & PassWord & "'));"
Set rsAdministrator = dbsConnection.OpenRecordset(sqlString)
' When finished close the recordset object
' if at end of file(EOF)search didnt find a match
If rsAdministrator.EOF Then
procDisplayMessage ("Are you sure you belong trying to get in here.")
rsAdministrator.Close
dbsConnection.Close
Exit Sub
Else
' Close Login Form
DoCmd.Close
' user found
procDisplayMessage ("Login siccessful, please push the button to
continue")
' open form Switchboard
DoCmd.OpenForm ("frmSwitchboard")
End If
' when finished close record set and db connection
rsAdministrator.Close
dbsConnection.Close
Exit Sub
End Sub
Graham Mandeno said:
Hi Troy
You should start by reading the Access Security FAQ. You can check it out
on-line at:
http://support.microsoft.com/support/access/content/secfaq.asp
or you can download a self-extracting file by visiting:
http://support.microsoft.com/?id=207793
Read it, then re-read it, then go to sleep with it under your pillow

--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
troy said:
I have heard of a way to make a table with the following..
1. username
2. password
if the user types in the correct info above he has access to the db if not
it will infome him his user name and or passsword is incorrect.
Is there an easier way or how is this procedure done. Any help is
appreciated.