Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timer Function on a Form

Status
Not open for further replies.

APS

Vendor
Sep 25, 2000
53
US
Hi
With out getting into to many details about what I am attempting, can someone explain how the timer function on a form works. Basically what I need to do is every 10 or 15 minutes check to see if someone adds a record to an open database and when they do to notify me by running my form for me to complete my action. I know I can and have done it with a loop checking the system time with the last time checked but this was done in the program and not the form using a timer. Is the timer better or am I doing the samething?

Thanks
Anthony
 
Anthony,

I think the timer is the way to go. Simply place a timer object on the form, place the code you want to run in the Timer Event method of the timer object and set the Interval property in milliseconds. (10000 or 15000 for the case you described.)

Have Fun.
Jon Pugh
 
Basically, a timer would do the same thing.
However, rather than having the program sit there and spin in a loop or sit in a wait state until the time comparison executed the loop, it would sit idle until the timer event "fired". Think of the timer event as the autosave feature in Word. You are able to edit your Word document and in the background the autosave 'timer' executes a [File][Save] every 10 minutes or so.

Compare the following examples:
*... Wait state
DO WHILE !lExit
WAIT WINDOW 'Pausing 10 minutes...' TIMEOUT 600
IF fnCheckFile()
DO fnSomething()
ENDIF
ENDDO {lExit}


In the form's 'Timer' event:
THISFORM.cmdCheckFile.Click()
the:
THISFORM.cmdCheckFile.Click
would contain:
THISFORM.fnCheckFile() function call.

I hope this helps.
ds.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top