Conditionally run code/macro

  • Thread starter Thread starter Timothy
  • Start date Start date
T

Timothy

I am in need of a code that essentially says:
IF I DONT open THISFORM (or click THISBUTTON doesnt
matter what it is) once a month, or week, Then RUN a MACRO.

I have a database that I Manage and I need to check for
duplicates, delete dups, run queries, and print reports.
These are the bare minimums to keep it running smooth and
get required paper work in on time. There are other tasks
I need to do, but they are not suspense date sensitive. I
am just the database ADMIN along with my real duties, so
there are times that I cant get to the database to do
these things.
Id like to automate it so even if I cant make it in the
essentials will get done, usually the end of the month
reports.

All Help is greatly appreciated.
Timothy
 
One possibility that occurs to me is that you could create a table to store
dates of when you do open the forms or click the buttons. You could add a
couple of lines of code to the form's load event or the button's click event
to add a new date to the table.

Once you have done that, you could add some code to the load event of your
startup form to check the latest date in the table (it would be easy to
define a query to do this). It could then fire whatever code you need if it
find that there are no entries within the last month, week, or whatever.

This isn't a spectacularly elegant solution, and I wouldn't surprised if
someone comes up with a neater way of doing it, but I think it ought to
work. Assuming, of course, that you open the database at least once a
month/week etc.

HTH

Adam
 
That is a pretty decent suggestion considering taht access does not have any
built-in jobs scheduler like its big brother SQL server.
Tim,
In addition to that, you could start your database using the windows task
scheduler and schedule it to start every day/week/month.
You should also include code to shut it down after certain tasks are done or
a certain time passes.

HS
 
That sounds like what I need. You would happend to have an
example of that code to do all this do you? Im new to the
code aspect, but pretty good on the basics.
Thanks again

TImothy
 
Thank you much adam. That does help. I have a grasp on
the on open and stuff, Im just learning about the coding.
I think thats still above me for right now. But im
learning..Thanks again
 
Back
Top