Getting a form to change on a timer
"james" wrote in message
...
snip
Is there a way to make it so that if a query has nil results/records that
it
automatically skips to the next Case/Query?
Private Sub Form_Timer()
Dim lngRetries As Long
Dim lngRecords As Long
Do
lngRetries = lngRetries + 1
Select Case Me.sfrTest.SourceObject
Case "table.college"
Me.sfrTest.SourceObject = "table.contact"
lngRecords = DCount("*", "contact")
Case "table.contact"
Me.sfrTest.SourceObject = "table.group"
lngRecords = DCount("*", "group")
Case Else
Me.sfrTest.SourceObject = "table.college"
lngRecords = DCount("*", "college")
End Select
If lngRecords 0 Then
Exit Do
End If
Loop Until lngRetries 2
End Sub
The purpose of the lngRetries variable is to prevent the code getting into
an endless loop if all three queries returned no records.
--
Brendan Reynolds
|