I am getting the dreaded "Write Conflict" error when the code reaches the "Me.Refresh" statement. This just started. I have not changed the code lately. This error popped up yesterday.
I have to refresh the information to make the THours calculate properly. I have read many posts about this message but I can't find one that seems to fit.
Thanks, Bill
Dim Interval As Date
Dim strOutput, StrMsg As String
Dim j As Integer
'Determine lenth of time worked on project:
Interval = (Me.Stop.Value - Me.Start.Value)
If Interval < 0 Then
StrMsg = "Stop time must be later than start time. Please Re-enter!"
j = MsgBox(StrMsg, vbOKOnly, "Error")
'Me.Start.SetFocus
Exit Sub
End If
'Convert hour:min to minutes:
strOutput = Int(CSng(Interval * 24)) & "." & 100 * (Format(Interval, "nn")) / 60
Me.WorkedDate.Value = Val(strOutput)
'Check for personal time:
If Me.[ProjectNo] = 0 Then Me.Personal.Value = Val(strOutput)
If Me.[ProjectNo] > 0 Then Me.Personal.Value = 0
Me.Refresh
Dim TheDate, i As Integer
TheDate = DatePart("w", FilterDate)
'Calculate total hours worked during day
Me.THours = DSum("WorkedDate - Personal", "tblTimeSheet", "tblTimeSheet!DateWkd = #" & Me.[FilterDate] & "# ")
'Determine daily hours worked and total for week period
If TheDate <> 1 Then
i = TheDate - 2
End If
NewDate = Me.FilterDate - i
Me.WHours = DSum("WorkedDate - Personal", "tblTimeSheet", "tblTimeSheet!DateWkd >=#" & NewDate & "# And DateWkd <=#" & NewDate & "# + 6 ")
I have to refresh the information to make the THours calculate properly. I have read many posts about this message but I can't find one that seems to fit.
Thanks, Bill
Dim Interval As Date
Dim strOutput, StrMsg As String
Dim j As Integer
'Determine lenth of time worked on project:
Interval = (Me.Stop.Value - Me.Start.Value)
If Interval < 0 Then
StrMsg = "Stop time must be later than start time. Please Re-enter!"
j = MsgBox(StrMsg, vbOKOnly, "Error")
'Me.Start.SetFocus
Exit Sub
End If
'Convert hour:min to minutes:
strOutput = Int(CSng(Interval * 24)) & "." & 100 * (Format(Interval, "nn")) / 60
Me.WorkedDate.Value = Val(strOutput)
'Check for personal time:
If Me.[ProjectNo] = 0 Then Me.Personal.Value = Val(strOutput)
If Me.[ProjectNo] > 0 Then Me.Personal.Value = 0
Me.Refresh
Dim TheDate, i As Integer
TheDate = DatePart("w", FilterDate)
'Calculate total hours worked during day
Me.THours = DSum("WorkedDate - Personal", "tblTimeSheet", "tblTimeSheet!DateWkd = #" & Me.[FilterDate] & "# ")
'Determine daily hours worked and total for week period
If TheDate <> 1 Then
i = TheDate - 2
End If
NewDate = Me.FilterDate - i
Me.WHours = DSum("WorkedDate - Personal", "tblTimeSheet", "tblTimeSheet!DateWkd >=#" & NewDate & "# And DateWkd <=#" & NewDate & "# + 6 ")