The intended use or desired result is that this code will prevent duplicate employee logins.
The Date is in column A, names are in column B, time in is in Column C and time out is in Column D.
I tried to make it search from bottom to top in Column B for the employee name value chosen in a combo box on a form.
When a match is found, Column C and D in that row should be checked and if they both have values.
I guess its assumed if both do, then we are looking at a completed punch. so we should select the last cell in the range, B436, and search up for the last date a punch was made in column A and select the row underneath it and punch in by placing mystr in column A, CboEmployeeName.Value in Column B and Now() in column C.
If there is a value in the in the punch in column (column c) when a name match is found in column A, check for a missing out in column D. If the in is present and the out is missing, we just get a dialogue box letting us know we are already punched in and no other code in the Sub is ran.
I came up with the following but after a while I was not able to keep it all straight in my head, I have a neurological health problem and it effects my concentration. If someone could help me finish this I would be super grateful.
The broken code is in Private Sub btnPunchIn_Click() in the form code.
Bookmarks