Hi all! I've been working on a part of my database in which the entrance and exit time of a persons attendance at a gym is recorded. For some reason i get the data type mismatch error for logging out. I don't know whats happening as the log in part of the code works fine and the fields in the table are date/time data types.The code is below:
Select Case Me.cboStatus.Value
Case Is = "Login"
DoCmd.RunSQL "INSERT INTO Gym_Attendance ([Student ID], [Gym Date], [Entrance Time]) VALUES ( '" & Me.txtStudentID.Value & "', Date(), Time())"
MsgBox "Login Successful"
Me.txtStudentID.Value = ""
Case Else
DoCmd.RunSQL "UPDATE Gym_Attendance SET [Exit Time] = Time() WHERE [Student ID] = ( '" & Me.txtStudentID.Value & "') AND [Gym Date] = Date()"
MsgBox "Logout Successful"
Me.txtStudentID.Value = ""
End Select
Select Case Me.cboStatus.Value
Case Is = "Login"
DoCmd.RunSQL "INSERT INTO Gym_Attendance ([Student ID], [Gym Date], [Entrance Time]) VALUES ( '" & Me.txtStudentID.Value & "', Date(), Time())"
MsgBox "Login Successful"
Me.txtStudentID.Value = ""
Case Else
DoCmd.RunSQL "UPDATE Gym_Attendance SET [Exit Time] = Time() WHERE [Student ID] = ( '" & Me.txtStudentID.Value & "') AND [Gym Date] = Date()"
MsgBox "Logout Successful"
Me.txtStudentID.Value = ""
End Select