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

Run Code Every Certain Amount of Days or Logins 2

Status
Not open for further replies.

infinitx

Technical User
Feb 26, 2004
212
US
Hi,

I have a code that is linked to a module....

On the onOpen Event of a form, I want the code to be executed every five days or to have it be executed every fifth time the form starts.

How could this be done?

Thanks,
Alex
 
HI alex,

One thing that jumps to mind is to build a table with 1 column. In the column have a "counter". By counter, have a number that you can increment each time the form is opened.

When that number is reached, have the module executed.

Kinda like:

if intCounter = 5 then
blah blah
else
increment counter +1
end if

you could add this check to the the onOpen event. oh, dont forget to reset your counter after 5 has been reached.


Have A Great Day!!!, [bigglasses]

Nathan
Project Manager III
 
Correct a table is the only approach. Although, I would use the user table that contains the user login info and store the counter for each successful login. The data check could also be based on values stored in the user table. So, add two fields to user table is my 2 cents. One field for Login Counter and Another for Last Login Date. When login code is triggered, make sure you reset the values in the table whereas counter will be zero and last login date is today. htwhm,

Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top