harleyskater
IT Manager
- Local time
- Today, 17:38
- Joined
- Oct 29, 2007
- Messages
- 95
I have a timeclock form, that allows people to clock in and out. The recordsource for that form is a table. I want to have the form check the table to see if someone has already clocked in, so they don't clockin twice without clocking out. There will have to be some sort of code/query that checks for a null value in the clockout field and the persons name selected in the combo box.
The form is simple, a dropdown combo box with employee names source is a select statement, a clockin date/time field set now() and a type field for is default "hourly" and then a cmdButton with this code
I do not know how to check for the number of records returned in a query. I assume if you could run a query that has clockout = null and dbo_employees.emp_first like emp_first and you could check to see if it returns a record then you could prompt with a clockin error that would be awesome. Does anyone know how to test for how many records are returned in vba?
The form is simple, a dropdown combo box with employee names source is a select statement, a clockin date/time field set now() and a type field for is default "hourly" and then a cmdButton with this code
Code:
Option Compare Database
Private Sub Command15_Click()
DoCmd.Close
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
lngAnswr = MsgBox("Is your Entry Correct " & emp_first & "?", vbOKCancel + vbQuestion)
If lngAnswr = vbOK Then
Cancel = False
MsgBox ("ClockIn Confirmed " & emp_first & "")
Else ' User chose No.
Cancel = True
MsgBox ("ClockIn Canceled " & emp_first & "")
End If
End Sub
Private Sub job_num_Change()
Me.item_id
End Sub
I do not know how to check for the number of records returned in a query. I assume if you could run a query that has clockout = null and dbo_employees.emp_first like emp_first and you could check to see if it returns a record then you could prompt with a clockin error that would be awesome. Does anyone know how to test for how many records are returned in vba?