Jump to content

Login with AdoDC and Access

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
jashsayani

jashsayani

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
I have made a Login form with MS Access and AdoDC in VB 6. I am having issues with the program, it says "Compile Error: Block If without End If". However, I have used End If.

Here is the code:



' AdoDC component is named: UsersDB

' 2 Textfields are "Username" and "Password"

' Database field 1 is username and field 2 is password (Field 0 is Name of staff)


UsersDB.Recordset.MoveFirst


Do Until UsersDB.Recordset.EOF

    If (UsersDB.Recordset(1) = Username.Text And UsersDB.Recordset(2) = Password.Text) Then

        frmMain.Show

        Unload Me

    End Sub

    

    Else

        UsersDB.Recordset.MoveNext

    End If

Loop


MsgBox ("INVALID LOGIN")




#2
jashsayani

jashsayani

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
Figured it out....

I had to use Exit Sub instead of End Sub.. :)

#3
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Exit Sub breaks out of the subroutine, while End Sub marks the termination of the subroutine.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#4
jashsayani

jashsayani

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts

Xav said:

Exit Sub breaks out of the subroutine, while End Sub marks the termination of the subroutine.

Yeah, learn't that now....

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Excellent. Good luck with your coding. ;)
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums