Solved

Implementing timers

Posted on 2003-10-29
6
213 Views
Last Modified: 2010-05-03
Hi everyone, I wonder if someone can help/advice/show me how to implement a timer that activate say about 00:00 every night and carry out specific tasks...I am kinda new to vb so noting too complicated..

thanks in advance..


 
0
Comment
Question by:bobgrossett
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
JNSTAUB earned 125 total points
ID: 9642469
timer1 is initialised at 60000 to avoid cpu load

Private Sub Timer1_Timer()

If transerror = True Then Beep
If Now() > transfertdate Then
PROCLABEL.Visible = True
call dosomething
Me.Refresh
Select Case frequency
'may be a daily, a weekly or a monthly activity
Case 0
transfertdate = DateAdd("d", 1, transfertdate)
Case 1
transfertdate = DateAdd("d", 7, transfertdate)
Case 2
transfertdate = DateAdd("m", 1, transfertdate)
End Select
Text4.Text = transfertdate
SaveSetting "WCTRANSFERT", "STARTUP", "NEXTPROC", transfertdate
'set a flag to beep each timer trigger if an errror was detected during the task dosomething
 If dosomething > 0 Then transerror = True
End If

PROCLABEL.Visible = False
End Sub

and other way is to create a service!
0
 
LVL 15

Expert Comment

by:SRigney
ID: 9642510
If you just want something scheduled for midnight and it's running another application you can use Task Scheduler.  
0
 
LVL 4

Expert Comment

by:JNSTAUB
ID: 10163499
my answer was correct .
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question