Form changes contents on a timer - how to get it to skip if nil re

J

james

Hi
The code below is for a form that changes contents on a timer. The contents
are received from a series of queries

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?

Cheers
James
_______________________________________________
Private Sub Form_Activate()
Me.TimerInterval = 5000

End Sub

Private Sub Form_Load()
Me.Child4.SourceObject = "Query.DisplayOrdersEURGBP"
Me.Label5.Caption = "EURGBP"
End Sub

Private Sub Form_Timer()

Select Case Me.Child4.SourceObject
Case "Query.DisplayOrdersEURGBP"
Me.Child4.SourceObject = "Query.DisplayOrdersEURUSD"
Me.Label5.Caption = "EURUSD"
Case "Query.DisplayOrdersEURUSD"
Me.Child4.SourceObject = "Query.DisplayOrdersGBPUSD"
Me.Label5.Caption = "GBPUSD"
Case "Query.DisplayOrdersGBPUSD"
Me.Child4.SourceObject = "Query.DisplayOrdersOther"
Me.Label5.Caption = "OTHER"
Case "Query.DisplayOrdersOther"
Me.Child4.SourceObject = "Query.DisplayOrdersEURGBP"
Me.Label5.Caption = "EURGBP"

End Select
End Sub
______________________________________________________
 
T

Tom van Stiphout

On Thu, 4 Feb 2010 07:52:13 -0800, james

You would have to first query the subforms to find out how many rows
there are. Or (but I like this less) run the same query as used for
the recordsource of the subforms.

What I might do is put these several subforms on a tab control, each
in their own tab. Then hide the actual tabs so it looks like just a
subform.
Now all subforms are open at all times, so you can easily get them to
requery and get their rowcount (using .RecordsetClone.RecordCount),
and you can use this info to decide which tab to activate.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top