I have identified the problem. With the code below, Goal updates back to 35, at the end of every hour just fine, until I change the Control Source of Me.Goal to Goal (a field in my table) (I need to record the associated goal rang-in with each record). Why would this be and how can I troubleshoot this?
Code:
Option Compare Database
Private Sub Form_Timer()
Me!Clock.Caption = Format(Now, "dddd, mmm d yyyy, hh:mm:ss AMPM")
End Sub
Private Sub Option102_Click()
Me.LID = CEMA
End Sub
Private Sub Process_Change()
If Me![Process] = "Authenticate" Then Me![HardGoal] = 35
If Me![Process] = "Receive" Then Me![HardGoal] = 35
End Sub
Private Sub Combo68_Change()
If Me![Combo68] = "Break" Then Me![Goal] = ([HardGoal] * 0.75)
If Me![Combo68] = "Full Shift" Then Me![Goal] = ([HardGoal])
If Me![Combo68] = "Lunch" Then Me![Goal] = ([HardGoal] * 0.5)
End Sub
Private Sub LID_AfterUpdate()
On Error GoTo ErrorHandler
Const cQuote = """"
Me!Operator.DefaultValue = cQuote & Me!Operator.Value & cQuote
Me!Process.DefaultValue = cQuote & Me!Process.Value & cQuote
Me!Goal.DefaultValue = cQuote & Me!Goal.Value & cQuote
If Hour(Now()) > Nz(Me.tbxHour, -1) Then
Me.Combo68 = "Full Shift"
Me.Goal = 35
Me.tbxCount = 0
Me.tbxHour = Hour(Now())
End If
Me.tbxCount = Me.tbxCount + 1
DoCmd.RunCommand acCmdSaveRecord
Me.Requery
ExitHandler:
Exit Sub
ErrorHandler:
Select Case Err
Case 3022
MsgBox "LID has already been recorded. Please use alternative LID."
DoCmd.Hourglass False
Resume ExitHandler
Case Else
MsgBox Err.Description
DoCmd.Hourglass False
Resume ExitHandler
End Select
Exit Sub
End Sub