Hi All,
I was tasked with creating a form to show the live daily results of a query that cycles through each record and also tells the form to automatically re-query at a set interval. The live results screen is displayed on a monitor that is left on throughout the day. Data is constantly being added to the tables throughout the day (hence the need for the automatic re-query).
I tested the form and it works fine when there is data present. The issue I have come across is at the beginning of the day when there would be no data for the query to pull. I need the live results screen to remain on (ready for when data has been entered) but not error out if there isn't any data.
Here's the coding for the form with the error occurring on the line highlighted in red:
Code:
Option Compare Database
Private Sub Form_Close()
DoCmd.OpenForm "frm_Live_Defects_VS_1_Cal_b"
End Sub
Private Sub Form_Timer()
Static intCount As Integer
intCount = intCount + 1
If intCount = 5 Then
'On form timer event requery form
Me.Requery
Else
On Error GoTo ErrorHandler
DoCmd.GoToRecord , , acNext
ExitHandler:
Exit Sub
ErrorHandler:
Select Case Err
Case 2105 'end of data
DoCmd.GoToRecord , , acFirst
Case Else
MsgBox Err.Description
DoCmd.Hourglass False
Resume ExitHandler
End Select
If intCount > 6 Then
'reset intCount to 0
intCount = 0
End If
End If
End Sub
Any ideas on how I can solve this issue?