If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Form changes contents on a timer - how to get it to skip if nil re
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 __________________________________________________ ____ |
#2
|
|||
|
|||
Form changes contents on a timer - how to get it to skip if nil re
On Thu, 4 Feb 2010 07:52:13 -0800, james
wrote: 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 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 _________________________________________________ _____ |
Thread Tools | |
Display Modes | |
|
|