Solved

VB6 and Access

Posted on 2000-05-11
2
213 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 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

740 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