kabir_hussein
09-25-2006, 03:19 AM
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
fdcusa
10-09-2006, 07:11 PM
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...
kabir_hussein
10-12-2006, 03:59 AM
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.
fdcusa
10-12-2006, 07:11 PM
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! :-)