Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 31st, 2005, 06:53 PM
Authorized User
 
Join Date: Jan 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Om for the help and your patients!

I tried your above code and came up with an error again in the highlighted yellow line. The error is: Runtime Error 3001
I need the LogInName to match the LogInPassword in the same row. Doesnt the EOF simply give a true or false statement? I really need to figure out how to search for the specific value in a field then validate with another field in the same row. Hope this makes a little sense. Perhaps I could Email you the project to proof. Thanks again for taking me under your wing on this.


Private Sub txtLogInPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then 'ENTER key press'
        LogInName = UCase(txtLogInName.Text)
        LogInPassword = UCase(txtLogInPassword.Text)
        LOGINrset.Open "SELECT * FROM [Login] WHERE UserName = '" & LogInName & "'", DBconnection, adOpenStatic, adLockReadOnly
        If LOGINrset.EOF Then
                MsgBox "INVALID LOGIN NAME..."
                End
                Else
                If LogInPassword = DBconnection.LOGINrset(Password).Value Then
                        Unload frmINTRO_window
                        End
                        Else
                        BadLogInCount = BadLogInCount + 1
                        If BadLogInCount = 3 Then
                                Unload frmINTRO_window
                                End
                                Else
                                txtLogInName.Text = ""
                                txtLogInName.SetFocus
                                MsgBox "INVALID PASSWORD..."
                        End If
                End If
        End If
End If
End Sub

 
Old January 31st, 2005, 07:25 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Modify the condition as:

  if LogInPassword = LOGINrset("Password") then
      'Valid password - Continue
  else
      'Invalid password
  end if


Om Prakash
 
Old January 31st, 2005, 07:33 PM
Authorized User
 
Join Date: Jan 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That seemed to work, Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Clone DAO Recordset into ADO Recordset kamrans74 VB How-To 0 March 6th, 2007 11:57 AM
dreamweaver(Database/recordset error ) Divya Kedia Dreamweaver (all versions) 0 March 18th, 2006 10:39 AM
Database Printing Recordset VB6 Hondacars VB How-To 1 March 11th, 2006 06:15 AM
ADO Recordset Scootterp Access VBA 4 February 27th, 2006 06:44 PM
Convert ADO recordset to DAO recordset andrew_taft Access 1 May 5th, 2004 02:31 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.