Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 572221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:35:25+00:00 2026-05-13T13:35:25+00:00

I already made security login that if failed 3 times the program will be

  • 0

I already made security login that if failed 3 times the program will be terminated. However, I want to make a security login that will lock the system and the admin will be required to login instead.

Here’s my code:

Dim nCnt As Integer
Dim nCnt2 As String

Private Sub cmdOk_Click()

    nUsername = "username ='" & txtUsername.Text & "'"
    npassword = txtPassword.Text

    If nCnt < 2 Then
        With adoLog.Recordset
            .MoveFirst
            .Find nUsername
            If .EOF Then
                MsgBox "Access Denied" & vbCrLf & "Please try again." & vbCrLf & vbCrLf & "Warning: You only have " & nCnt2 & " attempt.", vbCritical, "Terror"""
                nCnt = nCnt + 1
                nCnt2 = nCnt2 - 1
                Label7.Caption = nCnt2
                txtUsername.Text = ""
                txtPassword.Text = ""
                txtUsername.SetFocus
            Else
                If adoLog.Recordset.Fields("password").Value = npassword And adoLog.Recordset.Fields("flag").Value = 1 Then
                    Call Change_Flag
                    MsgBox "Access Granted"
                    cUser = adoLog.Recordset.Fields("name").Value
                    cPosition = adoLog.Recordset.Fields("position").Value

                    With adoHistory_Login.Recordset
                        .AddNew
                        .Fields("name").Value = cUser
                        .Fields("position").Value = cPosition
                        .Fields("time_login").Value = Time()
                        .Fields("date_login").Value = Date
                        .Fields("date_logout").Value = Date
                        .Update
                        Me.Refresh
                        frmMain.Show
                        frmMain.SetFocus
                    End With

                    Unload Me
                    txtUsername.Text = ""
                    txtPassword.Text = ""
                Else
                    MsgBox "Access Denied" & vbCrLf & "Please try again." & vbCrLf & vbCrLf & "Warning: You only have " & nCnt2 & " attempt.", vbCritical, "Terror"""
                    nCnt = nCnt + 1
                    nCnt2 = nCnt2 - 1
                    Label7.Caption = nCnt2
                    txtUsername.Text = ""
                    txtPassword.Text = ""
                    txtUsername.SetFocus
                End If
            End If
        End With
    Else
        Call block
        End
    End If

End Sub

Private Sub Change_Flag()

    With adoLog.Recordset
        .Fields("flag").Value = 0
    End With

End Sub

Private Sub block()

    MsgBox "You already used all attempt." & vbCrLf & "This will terminate the application.", vbCritical, "Terror"

End Sub

Private Sub Form_Initialize()

    cmdOK.Enabled = False
    txtPassword.Enabled = False
    cmdRegister.Visible = False

    If adoLog.Recordset.RecordCount <> 0 Then
        cmdOK.Enabled = False
        txtPassword.Enabled = False
        txtUsername.Enabled = True
    Else
        cmdRegister.Visible = True
        txtUsername.Enabled = False
    End If

End Sub

Private Sub Form_Load()

    nCnt2 = 2
    Label7.Caption = nCnt2

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:35:25+00:00Added an answer on May 13, 2026 at 1:35 pm

    You will need to store an additional flag somewhere to indicate that login is denied and then check this flag before attempting the login. You will also need to store the account type and check to see if the account is allowed to log in even if this flag is set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 292k
  • Answers 292k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you are looking for validating a Bloog Group format… May 13, 2026 at 6:12 pm
  • Editorial Team
    Editorial Team added an answer It's fairly unclear what you're asking here. Are you saying… May 13, 2026 at 6:12 pm
  • Editorial Team
    Editorial Team added an answer This doesn't occur on a Linux filesystem. I tested the… May 13, 2026 at 6:12 pm

Related Questions

We have an application for use in medical offices, and with CCHIT certification becoming
I am developing a CMS. One of the greatest everyday annoyances when working with
I'm am developing a Firefox extension which interfaces with an underlying Windows service (which
I have a MFC application with ATL support, the idea is when someone creates
Management has decided to go for Windows 2008 64 bit with IIS7 to service

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.