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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Timer Question

Status
Not open for further replies.

aw23

Programmer
Nov 26, 2003
544
IL
I really have not worked too much with form timers and so I'd like to run my idea by the experts, and if you guys don't mind giving me some feedback I'd really appreciate it.

I currently have a form with lots of clients and when a user calls a client or emails, etc, an 'action' is recorded in the actions table. Now the user can create a 'future action' where he will write the 'action' and specify the date and time as a date some time in the future. At that time I need a form to pop up to remind them that the 'future action' is to be done.

Now, this is my thinking. I record the 'future action' in the actions table as if it were a regular action (it has all the same information except that the date is a later date). I create another column in the table called reminders, which is a boolean.
Now, I have a form timer running. Every 30 seconds it checks the action table. It goes through the column of reminders. Any reminders that are set to true, it checks the date and time. If the date and time is now then it runs the reminder form. The user can either dismiss or snooze. If the user dissmisses then I set the boolean to false. If the user snoozes then I just change the time of the future action.
By the way, in case you are wondering I tried using the Outlook reminders. My boss did not approve, he wants the reminder in your face. He insists that it must be within the program.
I think this whole procedure is pretty simple. The only thing I'm not sure how to do in terms of syntax is the timer.
 
All you have to do is set the TimerInterval for your switchboard or other form that is always open to 30000, and its Form_Timer() event will fire every 30 seconds. Put all your Get/Set code in the Form_Timer() code block.

You can turn the timer off at runtime by setting the TimerInterval property to 0, and turn it back on by setting it back to 30000.

If you don't have a switchboard, you can open a form in Hidden mode and leave it open for the duration of the program:

[tt]DoCmd.OpenForm "frmReminders", , , , , acHidden[/tt]

In its Form_Timer() event you can perform your logic:
Code:
Option Explicit

Private Const TIMER_INTERVAL = 30000

Private Sub Form_Timer()
  [green]'1. Run a query to get active tasks for this user.
  '2. prompt user.
  '3. If user cancelled, run update query to turn off.
  '4. If user accepted, run task.[/green]
End Sub

[green]' allow user to turn off reminders so timer event won't eat up resources[/green]
Public Sub ToggleReminders()
  If Me.TimerInterval = 0 Then
    Me.TimerInterval = TIMER_INTERVAL
  Else
    Me.TimerInterval = 0
  End If
End Sub

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top