after you successfully logs in take the user access level and hold the value
using public variable or save it on a table then anytime you can retrieve
and use it.

HTH



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of pradeep reddy
Sent: Friday, July 21, 2006 9:07 PM
To: [email protected]; [email protected];
[email protected]
Subject: [ms_access] User Access Level


Hi All,

  I have a  form called frmLogon.......whcih has a Unbound combo box(User
Name)
                                                       Unbound Text
box(Password)
                                                        Command Button
(Login)

  The Source for this form is the tblEmployee Table......
  the fields are.....

  lngEmployee_ID   strEmployee_Name strPassword  strAccess_Level
  1                         Pradeep                   Pradeep        M
  2                          Reddy                     Reddy          T

  So I can able to log in using the below code but I want to put the user
access level after log in ,,,because I have form1,form2,form3,form4.

  Here Pradeep has access to all the forms.....Reddy has access to form1 and
form2...

  I am posting my code....any help please...I guess Understand my problem
above mentioned......



  Option Compare Database
  Private intLogonAttempts As Integer
  Option Explicit

  Private Sub cboEmployees_AfterUpdate()
  'After selecting user name set focus to password field
  Me.txtPassword.SetFocus
  End Sub
  -----------------------------------------------------------------

  Private Sub cmdLogin_Click()
  Dim lngMyEmployee_ID As Long

  'Check to see if data is entered into the UserName combo box

      If IsNull(Me.cboEmployees) Or Me.cboEmployees = "" Then
              MsgBox "You must enter a User Name.", vbOKOnly, "Required
Data"
              Me.cboEmployees.SetFocus
          Exit Sub
      End If

  'Check to see if data is entered into the password box

      If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
              MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
              Me.txtPassword.SetFocus
          Exit Sub
      End If

  'Check value of password in tblEmployees to see if this matches value
chosen in combo box

      If Me.txtPassword.Value = DLookup("strPassword", "tblEmployee",
"[lngEmployee_ID]=" & Me.cboEmployees.Value) Then

          lngMyTester_ID = Me.cboEmployees.Value

  'Close logon form and open splash screen

          DoCmd.Close acForm, "frmLogon", acSaveNo
      DoCmd.OpenForm "form1"

      Else
      MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid
Entry!"
      Me.txtPassword.SetFocus
      End If

  'If User Enters incorrect password 3 times database will shutdown

      intLogonAttempts = intLogonAttempts + 1
      If intLogonAttempts > 3 Then
          MsgBox "You do not have access to this database.  Please contact
your system administrator.", vbCritical, "Restricted Access!"
          Application.Quit
      End If
  End Sub

  --------------------------------------------------------------------------
-------------

  Private Sub Form_Open(Cancel As Integer)
  'On open set focus to combo box
  Me.cboEmployees.SetFocus
  End Sub







---------------------------------
See the all-new, redesigned Yahoo.com.  Check it out.

[Non-text portions of this message have been removed]





Yahoo! Groups Links










 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ms_access/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to