Results 1 to 4 of 4
  1. #1
    dharmacloud is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21

    Desperately need help with my database

    Dear all Access gurus!
    I'm a novice with Access 2007 and have been trying to create a student records database to hold student course registration, grades, etc. I have encountered several problems which I have spent many hours reading the forum for help but still haven't been able to resolve all my problems with the database. Are there any Access gurus with a kind-heart who is willing to help me look at my database and help me to complete my project?



    Many many thanks in advance!

  2. #2
    dharmacloud is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    21

    Login code not working correctly

    I need help to figure out why my code is not working correctly. Everything works fine except that it will allow the user to > 3 attempts. According to the code, it should close the entire database but that doesn't happen. Also, it will let me close the login form and access the entire database without even having to login. Please help fix my code!

    Here's my code:

    Code:
    Option Compare Database
    
    Private Sub cmdLogin_Click()
    
    'Check to see if data is entered into the UserName combo box
    
        If IsNull(Me.Combo2) Or Me.Combo2 = "" Then
          MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
            Me.Combo2.SetFocus
            Exit Sub
        End If
    
        'Check to see if data is entered into the password box
    
        If IsNull(Me.Text4) Or Me.Text4 = "" Then
          MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
            Me.Text4.SetFocus
            Exit Sub
        End If
    
        'Check value of password in tblEmployees to see if this
        'matches value chosen in combo box
    
        If Me.Text4.Value = DLookup("Password", "Employee", _
                "[EmployeeID]=" & Me.Combo2.Value) Then
    
            EmployeeID = Me.Combo2.Value
    
            'Close logon form and open splash screen
    
            DoCmd.Close acForm, "LogOn", acSaveNo
            DoCmd.OpenForm "Switchboard"
    
        Else
          MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
                "Invalid Entry!"
            Me.Text4.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 admin.", _
          vbCritical, "Restricted Access!"
        Application.Quit
        End If
              
    End Sub
    
    Private Sub Combo2_AfterUpdate()
    'After selecting user name set focus to password field
        Me.Text4.SetFocus
    End Sub

  3. #3
    robsworld78 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Posts
    181
    If everything works except for access not closing then trying changing

    Application.Quit

    to

    DoCmd.Quit

  4. #4
    robsworld78 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Posts
    181
    For letting you close the login screen just disable the close button and change the "shortcut menu" to no.

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

Similar Threads

  1. Replies: 20
    Last Post: 08-08-2011, 01:34 PM
  2. Replies: 3
    Last Post: 05-15-2011, 10:52 PM
  3. Replies: 1
    Last Post: 11-03-2010, 10:41 AM
  4. Help needed desperately
    By tinyuna in forum Access
    Replies: 0
    Last Post: 05-03-2007, 02:18 AM
  5. Replies: 1
    Last Post: 09-06-2006, 11:48 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