Help with login Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yoda
    Contributor
    • Dec 2006
    • 291

    #1

    Help with login Form

    The code is:

    Option Explicit

    Public LoginSucceeded As Boolean

    Private Sub cmdCancel_Click ()
    'set the global var to false
    'to denote a failed login
    LoginSucceeded = False
    End Sub

    Private Sub cmdOK_Click()
    'check for correct password
    If txtPassword = "" Then
    'place code to here to pass the
    'success to the calling sub
    'setting a global var is the easiest
    LoginSucceeded = True

    Else
    MsgBox "Invalid Password, try again!", , "Login"
    txtPassword.Set Focus
    SendKeys "{Home}+{En d}"
    End If
    End Sub


    I want to make it so if the user puts in their password and it works, but i have tried

    "Private Sub cmdOK_Click()
    'check for correct password
    If txtPassword = 0 Then
    'place code to here to pass the
    'success to the calling sub
    'setting a global var is the easiest
    LoginSucceeded = True"

    But it didn't work please Help anybody

    Yoda (Canada Eh)
  • yoda
    Contributor
    • Dec 2006
    • 291

    #2
    Sorry i figured it out just Any Hour a go sorry to trouble you guys

    Se ya

    Yoda (Canada Eh)

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by yoda
      Sorry i figured it out just Any Hour a go sorry to trouble you guys
      :) That's probably the best result for everybody.

      These archives are a great source of information. So for future reference, could you give us some idea of how you resolved the problem? That way it will be here if someone else comes looking for the same answer.

      Comment

      • yoda
        Contributor
        • Dec 2006
        • 291

        #4
        I answer was

        Private Sub cmdOK_Click()
        'check for correct password
        If txtPassword = txtPassword Then
        'place code to here to pass the
        'success to the calling sub
        'setting a global var is the easiest
        LoginSucceeded = True"

        so when some bdoy logins in it uses their password instead of the one you made up.

        the only change was If txtPassword = txtPassword

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          Originally posted by yoda
          ...the only change was If txtPassword = txtPassword
          I guarantee that this test will always return True, no matter what.

          Comment

          • seshu
            New Member
            • Nov 2006
            • 156

            #6
            Hi this is seshu
            i have both of your conversation, i was thrown into dilema as for as i know ever login form interacts with data base and in the above code i have not seen any data base connection or any such parameter so if there is any way such please help me out

            Comment

            • hariharanmca
              Top Contributor
              • Dec 2006
              • 1977

              #7
              Originally posted by yoda
              The code is:

              Option Explicit

              Public LoginSucceeded As Boolean

              Private Sub cmdCancel_Click ()
              'set the global var to false
              'to denote a failed login
              LoginSucceeded = False
              End Sub

              Private Sub cmdOK_Click()
              'check for correct password
              If txtPassword = "" Then
              'place code to here to pass the
              'success to the calling sub
              'setting a global var is the easiest
              LoginSucceeded = True

              Else
              MsgBox "Invalid Password, try again!", , "Login"
              txtPassword.Set Focus
              SendKeys "{Home}+{En d}"
              End If
              End Sub


              I want to make it so if the user puts in their password and it works, but i have tried

              "Private Sub cmdOK_Click()
              'check for correct password
              If txtPassword = 0 Then
              'place code to here to pass the
              'success to the calling sub
              'setting a global var is the easiest
              LoginSucceeded = True"

              But it didn't work please Help anybody

              Yoda (Canada Eh)
              The code you written is if he didn’t enter password then it will Login. Just explain briefly

              Comment

              • daveftl
                New Member
                • Jan 2007
                • 43

                #8
                Hi Seshu!

                i got a code with regards on login that connects to DB...hope this could help you , GOD BLESS!
                +++++++++++++++ +++++++++++++++ +++++++++++++++ +++++++++++
                Option Explicit

                Dim dave As New ADODB.Connectio n
                Dim gay As New ADODB.Recordset
                Dim gave As Boolean

                Private Sub Form_Load()

                Me.Width = 5235
                Me.Height = 3135

                'Initialize boolean
                gave = False

                End Sub

                Private Sub cmdSignIn_Click ()

                'Connection String
                With dave

                .ConnectionStri ng = "provider=Micro soft.Jet.OLEDB. 4.0;data source=" & App.Path & "\db1.mdb"
                .Open

                End With

                Debug.Print " Connection Created "

                'set recordset

                gay.Open "Select * from security", dave, adOpenDynamic, adLockReadOnly
                Debug.Print "recordset created"

                Do While gay.EOF <> True

                If gay(0) = txtUser.Text And gay(1) = txtPass.Text Then

                gave = True

                Exit Do

                End If

                gay.MoveNext

                Loop

                If gave = True Then

                Call forUnload

                Else

                MsgBox "Invalid Username and/or Password", vbInformation, "3ten systems"

                End If

                MDIForm1.mnuLog In.Enabled = False
                dave.Close

                End Sub
                +++++++++++++++ +++++++++++++++ +++++++++++++++ ++++++++++++
                +++++++++++++++ ++++ Nothing Follows++++++++ +++++++++++++++ +++

                Comment

                • yoda
                  Contributor
                  • Dec 2006
                  • 291

                  #9
                  Originally posted by seshu
                  Hi this is seshu
                  i have both of your conversation, i was thrown into dilema as for as i know ever login form interacts with data base and in the above code i have not seen any data base connection or any such parameter so if there is any way such please help me out
                  Sorry Seshu there is no database be i am just a beginer and don't know to yet
                  Sorry Yoda Canada Eh

                  P.S i'm just in high school

                  Comment

                  • yoda
                    Contributor
                    • Dec 2006
                    • 291

                    #10
                    Originally posted by hariharanmca
                    The code you written is if he didn’t enter password then it will Login. Just explain briefly
                    Its just a prank for the teachers at my school including students. i'm just in high school

                    Yoda Canada Eh

                    Comment

                    • knychtell
                      New Member
                      • Jan 2007
                      • 66

                      #11
                      hi, your only @ high school?, okey i see,if you want you could use this codes:

                      txtbox1.text=tx tbox1.text' i think it would be better not to use this line of code if you like someone not to gain access with your program, this would only mean that whatever that person enters in the txtbox will be validated and set to true, that in result they could enter your program.


                      you could use 2 txtboxes instead and write these codes to login button,

                      dim a, b string
                      dim 2 as new form2
                      a="username" ' in this line you could set the username of the person for validation

                      b = 'P@ssw0rd" - everytime the person try's to log in thier acct they must specify the right password


                      if txtbox1.text="u sername" and txtbox2.text= "P@ssw0rd" then
                      messagebox.show ("Welcome " & a)
                      2.show
                      me.hide' closes the login application and proceeds to the next form if and only if validated..

                      you could play to these codes.. and set some assess burnin...
                      have a good time,

                      Comment

                      • yoda
                        Contributor
                        • Dec 2006
                        • 291

                        #12
                        Yo dude nice i actually know what it means and see what i can do thanks.

                        Yoda

                        Canada Eh

                        Comment

                        Working...