Results 1 to 4 of 4
  1. #1
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142

    Log On Restricted

    I know there are a whole bunch of threads about this and I feel like I have checked them all. I have a Log in to start the database now the code is below, however I want the user when he/she logs on only to see their own record (which contains their user name and password) and nothing else in the database similar to a bank log on on the web and you see all your stuff but not every client the bank has. if I do this in a query the user can see only their account but can't edit it Is this possible, or am I a complete idiot Private Sub cmdEnter_Click()
    'Check to see if data entered into the UserName combo box
    If IsNull(Me.cmbUserName) Or Me.cmbUserName = "" Then
    MsgBox "You must select a User Name.", vbOKOnly, "Required Data"
    Me.cmbUserName.SetFocus
    Exit Sub
    End If
    'Check to see if data is entered into the password text box
    If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
    MsgBox "You must enter a valid password.", vbOKOnly, "Required Data"
    Me.txtPassword.SetFocus
    Exit Sub
    End If
    'Check value of password in the tblLogin to see if this matches value chosen in combo box
    If Me.txtPassword.Value = DLookup("Password", "tblUser", _
    "[UserID]=" & Me.cmbUserName.Value) Then
    MyEmpID = Me.cmbUserName.Value
    'Close logon form and open navigation screen
    DoCmd.Close acForm, "frmLogin", acSaveNo
    DoCmd.OpenForm "000Navigationfrm"
    Else
    MsgBox "Password invalid. Please try again.", vbOKOnly, _


    "Invalid Entry"
    Me.txtPassword.SetFocus
    End If
    'If User enters incorrect password 3 times database will close
    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 3 Then
    MsgBox "You do not have access to this database. Please contact the administrator.", _
    vbCritical, "Restricted Access"
    Application.Quit
    End If
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You should still be able to edit a query that restricts data to a given client. Make sure one of these doesn't apply:

    http://allenbrowne.com/ser-61.html
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Derrick T. Davidson is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    142
    Wondefull thank you (and allenbrowne.com) I can edit the query now

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Restricted Access - Admin v. User
    By need_help12 in forum Security
    Replies: 4
    Last Post: 04-30-2012, 09:51 AM
  2. Restricted Access Login Code Error
    By need_help12 in forum Programming
    Replies: 6
    Last Post: 04-27-2012, 08:48 AM
  3. Replies: 1
    Last Post: 08-10-2011, 12:04 AM
  4. Count Restricted by Date
    By cgjames in forum Queries
    Replies: 3
    Last Post: 01-19-2011, 04:41 PM
  5. user restricted query
    By adidashawn6 in forum Queries
    Replies: 1
    Last Post: 01-06-2011, 11:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums