VB script to run every 20 days

kabir_hussein

Registered User.
Local time
Today, 13:09
Joined
Oct 17, 2003
Messages
191
Hi

i have a report in my database that i need to run every 20 days or so, is there any coding that will allow me to run a report so i can check every 20 days or so when the database is open if any printers in our company have run out of warranty

Many thanks
 
An idea... Create a table/add to a table (whatever is best in your application) to store a date field called "LastRun". In an "AutoReport" module, use the datediff function to check if 20+ days have elapsed since last run, if so -- run it and update the LastRun field to current date...

Hope that helps...
 
Hi

Many thanks for the reply

Im not sure what you mean by "autoReport module"

i am trying to get either a form or even a message to tell the user to check if warranties have expired.
 
Oops, sorry I wasn't clear....

In reference to "AutoReport module". This would be a module that you create in the VB window (Alt-G). Then, wherever you want to automatically check if the report needs to be printed, call this module. Perhaps in the Main Menu form -- change the OnLoad event to run this module.

Pseudo Code:
Private Sub AutoReport ()
Get Date of last report-run from table
If this date more than 20 days old Then
Run the report
update the table to show today's date
End If
End Sub​
If you need more help, let me know. I am learning too! :-)
 

Users who are viewing this thread

Back
Top Bottom