connection to Access from VB6
What I would like to do is this:
When user and password is entered correct, I would like to show the full name of the user in the welcome MsgBox.
With this code I only show the user name that was entered to log in..
My database is set up with User, Password, FullName
any help? anyone?
On Error GoTo ErrHandler
'Connect to database
strCNString = "Data Source=" & App.Path & "\Users.mdb"
cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
cn.ConnectionString = strCNString
cn.Properties("Jet OLEDB:Database Password") = "mypassword"
cn.Open
'Open recordsource
With rs
.Open "Select * from Users where User='" & user.Text & "' and password='" & pass.Text & "'", cn, adOpenDynamic, adLockOptimistic
'Check username and password
If .EOF Then
MsgBox "Access Denied...Please enter correct password!", vbOKOnly + vbCritical, "Security Login"
user.Text = ""
pass.Text = ""
user.SetFocus
cn.Close
Else
Txt = "" & " " & UCase$(user.Text) & ""
MsgBox "Welcome!!!" & Txt, vbOKOnly + vbExclamation, "Security Login"
cn.Close
Unload Me
Mainform.Show
End If
End With

