Posted by: pspb 4 Jan, 2009 - 06:14 PM
CODE
Private Sub cmdLogIn_Click()
Set CN = New ADODB.Connection
Set RS = New ADODB.Recordset
CN.Open CNDetails
With RS
.Open "SELECT COUNT(*) As howmany FROM Manager WHERE Username=!" & txtusername.Text & "'", CN, adOpenDynamic, adLockOptimistic
Dim RCount As Integer
RCount = !howmany
If RCount >= 1 Then
.Close
.Open "SELECT * FROM Manager Where Username='" & txtusername.Text & "'", CN, adOpenDynamic, adLockOptimistic
Dim pass As String
pass = !Password
If pass = txtpassword.Text Then
MsgBox "Go ahead", vbExclamation, "Message"
Else
MsgBox "Access Denied", vbCritical, "Unknown User"
End If
Else
MsgBox "No record found." & txtusername.Text & "'", vbCritical, "Unknown user"
Exit Sub
Load frmmenu
frmmenu.Show
Unload Me
End If
End With
If txtpassword.Text = "" Then
MsgBox "provide your password!!!", vbCritical
Else
UserName = "san pablo"
Password = "bakeshop"
If txtusername = UserName And txtpassword = Password Then
MsgBox "Welcome to Panaderia San Pablo Bakeshop", vbExclamation
Load frmmenu
frmmenu.Show
Unload frmSS
Else
MsgBox "Access Denied", vbCritical
txtpassword.SetFocus
End If
End If
End Sub
Posted by: n8wxs 4 Jan, 2009 - 06:17 PM
Welcome!
Please post your code examples using tags:

You can edit your post to add the code tags.
Posted by: Jayman 5 Jan, 2009 - 10:12 AM
Are you getting any error messages?
Describe in detail exactly what is not working when you try to connect to your database.