I am new to access and I am sure I am missing something simple. I am creating a time task tracker and I have everything working the problem I am having is when the Start Time command button is clicked it logs everything like it is suppose to, but it creates a new line. I need it not to create this new line because when you click the command button to Stop Time it logs it on the new line. I need it log the Stop Time on the same record in the Stop Time field. The below is the code.
I tried to attach the database it wouldn't let me.
Can anyone help me with this? Please.
Code:
Private Sub cmbStartTime_Click()
Dim CountTime As Long
CountTime = DCount( Employee", "qryClockIn_ChckSysIN_1")
'Dim CountTime2 As Long
'CountTime2 = DCount( Employee", "qryClockIn_ChckSysIN_2")
If (CountTime > 0) Then
MsgBox "You need to complete previous Clock Out", vbOKOnly
ElseIf (CountTime2 > 0) Then
MsgBox "You need to complete previous Clock Out", vbOKOnly
ElseIf IsNull(Me.cmbxEmply) = True Then
MsgBox Select Employee from drop down list!", vbOKOnly
Else
Me.frmClckIn_SUB.SetFocus
Me.frmClckIn_SUB!Time_Start.SetFocus
DoCmd.GoToRecord , , acNewRec
'Me.frmClckIn_SUB!Employee = Me.cmbxEmply
Me.frmClckIn_SUB!Time_Start = Now
Me.frmClckIn_SUB!Task = cmbxTask
MsgBox "You have successfully clocked in at " & Now(), vbOKOnly
RunCommand acCmdSaveRecord
Me.frmClckIn_SUB.Form Refresh
Me.frmClckIn_SUB!Time_Stop.SetFocus
'DoCmd.GoToRecord , , acFirst
Me.Refresh
End If
End Sub
Private Sub cmbStopTime_Click()
Dim CountTime3 As Long
CountTime3 = DCount("Employee", "qry_ClckOut_ChckSysOUT")
If IsNull(cmbxEmply) = True Then
MsgBox "Select Employee from drop down list!", vbOKOnly
ElseIf (CountTime3 = 0) Then
MsgBox "You have no open Clock In records. Please return to Clock In.", vbOKOnly
Else
If Me.Dirty Then Me.Dirty = False
Me.Requery
Me.frmClckIn_SUB!Time_Stop = Now()
MsgBox "You have successfully clocked out at " & Now(), vbOKOnly
Forms!frmClockin.frmClckIn_SUB.SetFocus
'Forms!frmClockin.frmClckIn_SUB!cmbxEmply.SetFocus
DoCmd.GoToRecord , , acFirst
Forms!frmClockin.frmClckIn_SUB.Requery
Forms!frmClockin.frmClckIn_SUB.Form.Refresh
End If
End Sub