Limit A Macro To Rum Once A Day

andylooney

Registered User.
Local time
Today, 23:21
Joined
May 31, 2006
Messages
10
Hi all,

I have a button on a form that runs a macro,

This button should be ran in the morning each day, but there are two people that run this button and it gets a little confusing when you don't know its been pressed at all or the other person has pressed it and you have also.

I would like to add something onto my macro that can use the date from my machine and run the macro once per day, then if the button is pressed again on the same day would tell the other person that it has already been ran.

is this easy to do?

any help would be much appreciated.

Andy
 
Use a parameter table, and before the macro starts, check a parameter of last run date, and make sure it is not equal to date(). If it isn't, update it to date() and run whatever.
I typically setup a parameter table with a primary key that is short (usually 15 characters) but can contain a meaninful value (Say MACRODATE in this case) and some generic fields, like PTdate, PTint, PTstring and use one row per parameter I need to be referenced by the key.
 

Users who are viewing this thread

Back
Top Bottom