Solved

VB6 and Access

Posted on 2000-05-11
2
210 Views
Last Modified: 2008-02-01
Trying to program a login screen in VB6. Need to find out how to get the application to check the username & password in an Access db to see if the user is a member, then if the username & password are correct display the entire record.
0
Comment
Question by:G_Funk
2 Comments
 

Accepted Solution

by:
CarmenSense earned 50 total points
ID: 2799800
Here is an example of using a DAO data control on the form:

' (Data2 data control is pointed to an Access table with containing fields:  'User ' & 'Password' )

Dim xUSER As String, xPASS As String
Dim Bad1 As Boolean
   
Bad1 = True
       
Data2.Recordset.FindFirst "User = '" & UCase(TDBText1) & "'"

If Not Data2.Recordset.NoMatch Then
        If UCase(TDBText2) = Data2.Recordset.Password Then
            Bad1 = False
        End If
    End If
       
    If Bad1 = True Then
        Beep
        MsgBox "Incorrect Password"
        TDBText1 = ""
        TDBText2 = ""
        TDBText1.SetFocus
    Else
        ' Continue Here by diplaying your entire record if desired.

        ' Loads Main menu form.
        Load Form2
        Form2.Show
        Unload Me
    End If
0
 
LVL 20

Expert Comment

by:hes
ID: 2801301
Two text boxes names name and password
Data1 control pointing to your access database

Data1.RecordSource = ("Select * from Table_Name  where name = '" & Name.text & "' ")
Data1.Refresh
If Not Data1.Recordset.EOF Then 'name is on file
  If Password.text <> Data1.Recordset("PASSWORD") Then
    ' invalid password
    ' do your invalid password code here
  Else
    ' good password
    ' do your code for a valid user here
  End If
End If
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vb.net 2008 2 56
Paint/Redraw window while dragging 16 68
Visual Studio 2005 text editor 10 35
How to make an ADE file by code? 11 79
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now