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

  • SEARCH
  • Home
  • 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 4267106
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:51:11+00:00 2026-05-21T06:51:11+00:00

I have some query about my code, I am using VB6.0 and I have

  • 0

I have some query about my code, I am using VB6.0 and I have a question using TimerControl… The user will first Login[frmLogin] and then the UserID and Password must recognize whether it is Admin or Guest. Once it was recognized as Admin, the user will be redirected to the frmAdmin and if not, he will be redirected to frmEmployee after the Timer[tmLogin]/Progressbar[pgLogin] reaches 100%. I’m just perplexed because I am using database with two tables[tblEmployee & tblPosition]. Each Table has an index: idxid for tblEmployee and idxpost for tblPosition… I don’t know where to insert the conditional statement… Please help me out, once it was resolved, it will be my rule for the further problem that I might encounter… Thanks in advance. Here is my code

Private Sub cmdContinue_Click()
Dim boolLogedIn As Boolean
    If Me.txtUserID.Text = "" And Me.txtPassword.Text = "" Then
        Me.lblWarning.Caption = "*User ID and Password must not be a null."
        Me.tmLoginformSize.Enabled = True
        Me.txtUserID.SetFocus
        Beep
    ElseIf Me.txtUserID.Text = "" Then
        Me.lblWarning.Caption = "*User ID must not be a null."
        Me.tmLoginformSize.Enabled = True
        Me.txtUserID.SetFocus
        Beep
    ElseIf Me.txtPassword.Text = "" Then
        Me.lblWarning.Caption = "*Password must not be a null."
        Me.tmLoginformSize.Enabled = True
        Me.txtPassword.SetFocus
        Beep
    Else
        Do Until datLogin.Recordset.EOF
            With datLogin.Recordset
                If Me.txtUserID.Text = !empid And Me.txtPassword.Text = !Password Then
                    boolLogedIn = True
                    Exit Do
                Else
                    datLogin.Recordset.MoveNext
                End If
            End With
        Loop
        If boolLogedIn = True Then
            Me.tmLogin.Enabled = True
            Me.lblConnecting.Visible = True
            Me.lblLoginPercent.Visible = True
            Me.pbLogin.Visible = True
        Else
            Me.lblWarning.Caption = "*User ID and Password did not match."
            Me.datLogin.Recordset.MoveFirst
            Me.tmLoginformSize.Enabled = True
            Beep
        End If
    End If
End Sub

Private Sub tmLogin_Timer()
    With Me.pbLogin
        Me.pbLogin.Value = Me.pbLogin.Value + 1
        Me.lblLoginPercent.Caption = Str(Me.pbLogin.Value) + "%"
        If Me.pbLogin.Value >= 1 And Me.pbLogin.Value < 50 Then
            Me.lblConnecting.Caption = "Connecting..."
        ElseIf Me.pbLogin.Value >= 50 And Me.pbLogin.Value < 100 Then
            Me.lblConnecting.Caption = "Logging in..."
        Else
            Me.lblConnecting.Caption = "Done..."
            frmLogin.Hide
            frmEmployee.Show
            Me.tmLogin.Enabled = False
        End If
    End With
End Sub

…Here is my screenshots
my tables

my frmLogin

  • 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-21T06:51:12+00:00Added an answer on May 21, 2026 at 6:51 am

    Here is how I would accomplish what you are looking for with minimal changes to
    your code :

    'Add this declaration 
    Dim m_intLoggedInUserType As Integer
    
    Private Sub cmdContinue_Click()
        'Unchanged code
    
            Do Until datLogin.Recordset.EOF
                With datLogin.Recordset
                    If Me.txtUserID.Text = !empid And Me.txtPassword.Text = !Password Then
                        boolLogedIn = True
                        m_intLoggedInUserType = !postId
                        Exit Do
                    Else
                        datLogin.Recordset.MoveNext
                    End If
                End With
            Loop
    
            'More unchanged code
    End Sub
    
    Private Sub tmLogin_Timer()
        With Me.pbLogin
            'Unchanged code
    
                Me.lblConnecting.Caption = "Done..."
                frmLogin.Hide
    
                if m_intLoggendInUserType = 1 Then 
                   frmAdmin.Show
                Else
                   frmEmployee.Show
                End If
    
                Me.tmLogin.Enabled = False
            End If
        End With
    End Sub
    

    You should take note of Rasel’s answer as well, since working directly with the connection and the recordset objects are preferable to the datacontrol.

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

Sidebar

Related Questions

I am debugging some code and have encountered the following SQL query (simplified version):
We have some client code which is using the SqlConnection class in .NET to
I have some questions about using MySQLi queries, and related memory management. Suppose I
I'm about to have to deal with some SQL code in classic ASP VBScript.
I have a question about testing the queries in a transaction. I've been using
I have a PHP Code, that uses a web service to query some data.
I have some funny deadlock caused by a stupid simple SQL UPDATE query, on
I have an access query which creates some output, 3 columns named e.g. A
I have a MySQL query like this: SELECT *, SUM(...some SQL removed for brevety)
I have a large query (not written by me, but I'm making some modifications).

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.