can someone help me. I'm having a problem with my user log.
All i need is to record the logintime and timeout of the user once he/she login/logout in the system. My problem is, the record doesn't increment in the database. instead it was just keep updating the record. please help me. thanks in advance.
here is my code
Private Sub cmdLogin_Click()
Adodc1.RecordSource = "SELECT * FROM guest WHERE UserName ='" + Text1.Text + "'"
Adodc1.Refresh
If (Adodc1.Recordset.EOF = False) Then
If Text4.Text <> "" Then
If (txtPassword.Text = Adodc1.Recordset.Fields("Password")) Then
Adodc1.Recordset.Fields("Timein") = Time
Adodc1.Recordset.Fields("Date") = date
Adodc1.Recordset.Update
MsgBox ("Login Successful"), vbInformation, "Clinic Sytem"
Unload Me
frmmainguest.Show
Else
MsgBox ("Login Failure. Incorrect Password"), vbExclamation, "Clinic Sytem"
End If
Else
Text4.Text = MsgBox("All Fields are required", vbExclamation, "Clinic System")
Text4.Text = ""
End If
Else
MsgBox ("Login Failure. Username does not exist."), vbExclamation, "Clinic System"
End If
---------------------------
Private Sub cmdLogout_Click()
With Adodc1
If Text1.Text = "guest" Then
Adodc1.Recordset.Fields("Timeout") = Time
Adodc1.Recordset.Update
End If
All i need is to record the logintime and timeout of the user once he/she login/logout in the system. My problem is, the record doesn't increment in the database. instead it was just keep updating the record. please help me. thanks in advance.
here is my code
Private Sub cmdLogin_Click()
Adodc1.RecordSource = "SELECT * FROM guest WHERE UserName ='" + Text1.Text + "'"
Adodc1.Refresh
If (Adodc1.Recordset.EOF = False) Then
If Text4.Text <> "" Then
If (txtPassword.Text = Adodc1.Recordset.Fields("Password")) Then
Adodc1.Recordset.Fields("Timein") = Time
Adodc1.Recordset.Fields("Date") = date
Adodc1.Recordset.Update
MsgBox ("Login Successful"), vbInformation, "Clinic Sytem"
Unload Me
frmmainguest.Show
Else
MsgBox ("Login Failure. Incorrect Password"), vbExclamation, "Clinic Sytem"
End If
Else
Text4.Text = MsgBox("All Fields are required", vbExclamation, "Clinic System")
Text4.Text = ""
End If
Else
MsgBox ("Login Failure. Username does not exist."), vbExclamation, "Clinic System"
End If
---------------------------
Private Sub cmdLogout_Click()
With Adodc1
If Text1.Text = "guest" Then
Adodc1.Recordset.Fields("Timeout") = Time
Adodc1.Recordset.Update
End If