hello sir..i already put the word "Username" in my textbox thank you for this sir...regarding to the remember me sir it always rememeber to the one user account...is this possible sir it can remember also to other user if they click the remember me..example first user.. username=Jenny password=*****.so if the user click the remember me..then after that the user will exit so the rememeber me is already check so when it compile again this will display to the textbox with the username=jenny and password=***.but if the user unclick this and change the username=michael password=*** and click again so that this new user name will be remember if he exit and compile again the program..so username= michael will now be display to the texbox with corressponding password... please help me on this sir...here is my code...hoping for your positive responds...thank you in advance sir...
Option Explicit
Public con As ADODB.Connection
Private user_rs As ADODB.Recordset
Public cmd As ADODB.Command
Private m_user As String
Private m_pass As String
Private sql As String
Private attempts As Integer
Private WithEvents remember_rs As ADODB.Recordset
Private login_rs As ADODB.Recordset
Private Sub Form_Load()
Set con = New ADODB.Connection
Set user_rs = New ADODB.Recordset
Set remember_rs = New ADODB.Recordset
Set cmd = New ADODB.Command
Set login_rs = New ADODB.Recordset
con.Open "provider = microsoft.jet.oledb.4.0; data source = " & App.Path & "\password.mdb;persist security info =false; jet oledb:database password=eldenz;"
user_rs.Open "select user_name,user_pass,rememberYesNo from security ", con, adOpenStatic, adLockOptimistic
If user_rs.BOF = True Or user_rs.EOF = True Then
MsgBox "not register yet"
Exit Sub
Else
If Not user_rs!rememberYesNo = "No" Then
txtuser.Text = user_rs!user_name
txtpass.Text = user_rs!user_pass
txtpass.PasswordChar = "*"
chkbox.Value = 1
End If
End If
Me.Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
attempts = 0
user_rs.Close
End Sub
Private Sub cmdlog_Click()
m_user = Trim(txtuser.Text)
m_pass = Trim(txtpass.Text)
Set user_rs = New ADODB.Recordset
sql = "select COUNT (user_name) AS JEMEBE FROM SECURITY where user_name = '" & m_user & "' and user_pass ='" & m_pass & "'"
user_rs.Open sql, con, adOpenDynamic, adLockOptimistic
If user_rs.Fields("JEMEBE") = 0 Then
attempts = attempts + 1
MsgBox "Maybe You have Incorrect Username and Password", vbExclamation, "Please sign-up to register account"
lblattempt.Caption = attempts
If attempts = 1 Then
MsgBox "you have 2 attempt left"
ElseIf attempts = 2 Then
MsgBox "You have 1 attempt remaining,this is your last chance."
End If
If attempts = 3 Then
txtuser.Enabled = False
txtpass.Enabled = False
MsgBox "You have already consume your 3 attempts...try again tomorrow.!!"
End If
Exit Sub
Else
Unload Me
Form6.Show
user_rs.Close
End If
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub lblremember_Click()
If chkbox.Value = 0 Then
chkbox.Value = 1
Else
chkbox.Value = 0
End If
Set user_rs = New ADODB.Recordset
user_rs.Open "select * from security ", con, adOpenStatic, adLockOptimistic
If user_rs.BOF = True Or user_rs.EOF = True Then
If chkbox.Value = 0 Then
chkbox.Value = 1
Else
chkbox.Value = 0
End If
Else
If user_rs!rememberYesNo = "No" Then
user_rs!rememberYesNo = "Yes"
user_rs.Update
Else
user_rs!rememberYesNo = "No"
user_rs.Update
End If
End If
End Sub
Private Sub lblsign_Click()
Form16.Show
Unload Me
End Sub
Private Sub txtpass_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
cmdlog_Click
Else
If txtpass.Text = "Password" Then
txtpass.Text = ""
txtpass.PasswordChar = "*"
End If
End If
End Sub
Private Sub txtuser_KeyPress(KeyAscii As Integer)
If txtuser.Text = "Username" Then
txtuser.Text = ""
End If
End Sub