Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / August 2005

Tip: Looking for answers? Try searching our database.

Looping help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
webster - 04 Aug 2005 22:22 GMT
I have 5 graphs all of which are in an active window, however I only want one
of them to update every ten seconds, the other 4 can update every minute.
Each graph sucks in about 6000 records each so I am trying to cut down on
unnecessary hits to the server and network traffic. I have simply put in the
OnTimer event the following...

Private Sub Form_Timer()
Dim Graph As Control

Set Graph = Me!graphAll
Graph.Requery

Set Graph = Me!graph1
Graph.Requery

Set Graph = Me!graph2
Graph.Requery

etc....

The "graphAll" needs to update every 10 seconds. The others every minute on
the whole minute. I am not sure where to start with this. Any help is
appreciated.
Al Camp - 04 Aug 2005 23:20 GMT
I think I'd try a "counter" to solve this problem.
Every time the GraphAll requeries, increment a variable (ex.
RequeryCounter - Integer) to 10,20,30... up to 60.  At 60 requery the other
forms, and reset the counter to 0.  (did not test this code, but it should
fly... tweak to suit)

Private Sub Form_Timer()
Dim Graph As Control
Dim RequeryCounter as Integer

Set Graph = Me!graphAll
Graph.Requery
RequeryCounter=RequeryCounter+10

If RequeryCounter = 60 Then
'refresh the other 3 graphs.....
RequeryCounter = 0
End If

hth
Al Camp

>I have 5 graphs all of which are in an active window, however I only want
>one
[quoted text clipped - 22 lines]
> the whole minute. I am not sure where to start with this. Any help is
> appreciated.
Dirk Goldgar - 04 Aug 2005 23:22 GMT
> I have 5 graphs all of which are in an active window, however I only
> want one of them to update every ten seconds, the other 4 can update
[quoted text clipped - 19 lines]
> minute on the whole minute. I am not sure where to start with this.
> Any help is appreciated.

Set the TimerInterval to the smallest interval you need;  in this case
10 seconds = 10000 milliseconds.  Requery the "graphAll" graph every
time the Timer event fires, requery the others only every 6th time (for
once every 60 seconds).

'----- start of code -----
Private Sub Form_Timer()

   Static lngCtr As Long

   Me!graphAll.Requery

   If lngCtr = 0 Then
       Me!graph1.Requery
       Me!graph2.Requery
       Me!graph3.Requery
       Me!graph4.Requery
   End If

   lngCtr = lngCtr + 1
   If lngCtr > 5 Then
       lngCtr = 0
   End If

End Sub
'----- end of code -----

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.