I am building a clockin and a clockout form. It's seems to be working great except ! I am running through some possible scenerios of how people might be able to cause errors and I have one. I can't tell where its coming from hahahah.
The scenerio's are: The user clocks in normally.
1. They put their name and hit clockin
2. They choose their name and thier process# and then hit clockin.
The problem starts with the scenerio 1. Leaving the process blank means they do not know at the time they started working what process it would be, but at the end when they clockout it gives them an option to enter the process#. They have!! have have to have a process# when they clockout. If they hit the clockout Command Button and there is no process_ID in the field I have an if statement catch that and prompt them with a message box. Then this is where the problem comes in somewhere. after hitting ok on the message box, they then go and enter the processID into the field. When they hit clockout again it says "This record has been changed by another user since you started editing it, if you save the record it will overwrite the changes.............."
Hahah I am attaching the code!. I hope someone knows whats up with this!
Private Sub clockout1_Click()
If emp_id >= 1 And process_id >= 1 Then
lngAnswr2 = MsgBox("Is your Entry Correct ?", vbOKCancel + vbQuestion)
If lngAnswr2 = vbOK Then ' User chose Yes.
CurrentDb.Execute "UPDATE dbo_timeclock SET clockout = Now() WHERE Emp_ID = " & Me.emp_id & " AND IsNull(clockout)"
DoCmd.Close ' update timeclock table with clockout time and close form
Else ' User chose No.
MsgBox "You have canceled your ClockIn!", _
vbExclamation, "ClockIn Canceled!"
Set Me.Recordset = Nothing
MsgBox "Please Make sure you have entered your Clock Number!", _
vbExclamation, "Did you forget your ClockIn #?"