code for a recurring event

hilbertm

Registered User.
Local time
Today, 08:12
Joined
Sep 7, 2001
Messages
46
I am teaching myself VBA and have come to a roadblock.

I have an event (task that needs to be completed) every 56 days, with the countdown starting on a specific date. I would like to show a warning when my database main menu starts up. I would like the warning to only show up 5 days prior to the 56th day to remind the users that the task will be due. It would be nice if the pop up or msg box would show the days remaining until the task was due. So at the 53rd day a message would show up that states “5 days until task is due”.

I am not sure how to code any of this, especially an event that will happen every Xth day. If anyone can answer my question without taking up too much of your time I would appreciate it.

Mike
 
Is the event to be run every 58 days on the calender or every 58 days after something happens in the database?

Basically, you can dummy a table to contain a field called DateTaskDue.

You will need to create Code to check the value of DateTaskDue against the current date.

Private Sub CheckTaskDate()

If DateTaskDue +53 >= Date()-5 Then
Msgbox "Task is due"
End If
Else

continue on...

End Sub

My code is really rough. I'm still learning myself. I believe you can improve on it to do more.

Just to point you in the direction you asked. HTH



[This message has been edited by jwindon (edited 09-29-2001).]
 
Thanks for the response. I think this is a great start. I guess it is a simple thing to do, I am just very new at this. I guess I could write some code to re-set the date in DatetaskDue to the current date at the 56th day so the message will pop up every time the event is due
 
Here's a thought. Have your code open a form that reads "Task is due. Do you want to run this task?". Have two command buttons on it below that, one YES one NO. On the yes, write code that does your task AND resets the TaskDueDate to the current date.

Good luck.

On the NO command button.

Docmd.Close acForm "YourTaskNoteForm",,acSaveNo
 

Users who are viewing this thread

Back
Top Bottom