Login Username and Password

mircho

Registered User.
Local time
Today, 04:45
Joined
Jul 28, 2013
Messages
11
Hi, I am not really familiar how this could happen, but I am currently creating a database, that will have 2 forms to be displayed when the user enters his credentials - administrative or user form from which they will proceed. What I need is a macro that will lead me on a click of a button to either admin or user form.
Lets consider I have put all the usermaness and their initial passwords in tblCredentials with columns Username, Password and Status (where the status is user or admin). Can someone help me out with this?
 
DLookup on tblCredentials should do the trick.

Code:
IF DLookup("Status" , "tblCredentials" , "Username = " & Me.Username  & _
      " AND Password = " & Me.Password) = "Admin" Then
  DoCmd.OpenForm "TheAdminFormName"
ELSE
     DoCmd.OpenForm "TheUserFormName"
End If

Another way is to base the log in form on table tblCredentials.
 
Nope, it returns a mistake in the body of the macro. It shows that it is in Me.Username.
 
Maybe your control is not named "Username".
 

Users who are viewing this thread

Back
Top Bottom