?
Solved

VB6 and Access

Posted on 2000-05-11
2
Medium Priority
?
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
CarmenSense earned 100 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
Suggested Courses

764 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