I am struggling to get my head around how to do this.
I have 2 tables in a database. 1. EmpT. (EmpID, EmpName) 2. EmpTimeT (EmpTimeID, EmpID, TimeIn, TimeOut).
I have a list on the form which shows all EmpNames from EmpT and that automatically pulls the EmpID into a hidden field.
I have set up a button to create new record in EmpTimeT with TimeIN = now() and the EmpID of the person highlighted in the list, but can't figure out how I can get the timeOut as well.
I tried using 1 button to do time in, which created a new record in EmpTimeT with EmpID and TimeIn, and a TimeOut button to do TimeOut = now() when pressed, but the timeout button ended up creating a new record with TimeOut stamped instead of updating the TimeOut field in the record that was created with the TimeIn button.
Ideally I would have only 1 button and if a person is selected and they have not already clocked in, it would, when they click it, create a new record of the EmpID and the TimeIn. Then if they click it again, it would time stamp the TimeOut against that record. So it would always be creating a new record unless they had not clocked out, in which case it would stamp the TimeOut field.
If 1 button setup is difficult, then I could settle for a timeout button as well to update the timeout field.
I guess I'm struggling to comprehend how to do an always create new record unless timeIn is not null and timeOut is null, in which case update timeout.
I thought excel was difficult but I can get by on that ok, access is a different and new beast that is getting the better of me.
Any ideas would be really appreciated.
Thanks.