Results 1 to 5 of 5
  1. #1
    Join Date
    May 2013

    Unanswered: About Log In Form

    Hi All,
    This is my second post in this forum and I hope I'll get response quickly from this forum.

    Okay I've a database file where there is a log-in form for password facilities. Now my requirement is:- How do close log in form automatically after log in?
    My code of log in command button is:
    Public Sub Login()

    On Error GoTo ErrorHandler:

    If IsNull([cboUser]) = True Then 'Check UserName
    MsgBox "Username is required"

    ElseIf IsNull([txtPassword]) = True Then 'Check Password
    MsgBox "Password is required"


    'Compare value of txtPassword with the saved Password in tblUser
    If Me.txtPassword.Value = DLookup("Password", "tblUsers", "[UserName]='" & Me.cboUser.Value & "'") Then
    strUser = Me.cboUser.Value 'Set the value of strUser declared as Global Variable
    strRole = DLookup("Role", "tblUsers", "[UserName]='" & Me.cboUser.Value & "'") 'set the value of strRole declared as Global Variable
    MsgBox "Welcome Back, " & strUser, vbOKOnly, "Welcome"
    DoCmd.OpenForm "MainForm", acNormal, "", "", , acNormal

    MsgBox "Invalid Password. Please try again.", vbOKOnly, "Invalid Password"
    intLogAttempt = intLogAttempt + 1

    End If

    End If

    'Check if the user has 3 wrong log-in attempts and close the application
    If intLogAttempt = 3 Then
    MsgBox "You do not have access to this database.Please contact admin." & vbCrLf & vbCrLf & _
    "Application will exit.", vbCritical, "Restricted Access!"
    End If


    End Sub

    I hope you'll help again.

  2. #2
    Join Date
    May 2013
    So there is nobody to solve my problem!!!!

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    I suppose you cold use me.close, but in all honesty I dunno, especailly as in this context I always use the network logon as authentication, and then match that logon to the user group authorisation. that way rounb a user doesn't have to logon on, or remember the password. I don't have to maintain logon code. the network handles the password. Every netwrok I've worked on recently is set up with one user accounbt per physical person, so there is no risk that multiple people can logon with the same credentials (which your system allows.
    Proper security is a tough proposition in most databases environemnts, however its especially tough in the Access /JET environment. if you require security and or tracability then do soem reading up on security. there is a FAQ that access produce for securing an application which is good, but doesn't cover all elements of security.

    if your application has to have legal robustness (ie capable of taking to court as evidence, or in HR disciplinary or financial reporting) then your current approach won't cut it
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 2
    The simplest way would be to use healdem's solution, given that you've already opened the next form. I generally stick a pair of form names into the command button's tag value, and use that as an argument for a sub that opens and closes forms for me, but that takes more work when setting up new forms.

    I would also second his advice in using the network ID to control access - that way, your application is at least as secure as your office's network, which ought to satisfy most internal auditors. You will need to carry out a couple of other steps to lock it down properly (using a password to restrict editing access to the VBA module, using a startup form, disabling the bypass key for most users).

    BTW, this is a forum, not a support service. If you post a question on a Sunday, it's not reasonable to expect an answer within three hours! :P
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  5. #5
    Join Date
    May 2013
    I think you both are right. Anyway I've used me. command but result is negative. I think network ID would be best. You both are amazing and also you are helpful too.
    Thanks for good advice and awareness.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts