Date Validation Question

K

KC Classic

I have a macro that runs several appencd queries once a command button on the
Switchboard is clicked and updates 5 separate tables with "current" data.
Although this database in only used by about 4 people overall (and mostl of
the time by only one person), there is a distinct possibility that a person
could update the tables more than one time with "current" data. This is a
real problem to correct.

I would like to be able to have the command button function only one time
each day and then be "disabled" after the tables have been updated. Is this
possible?

We just use some basic fields as follow:

txtMgmtCo
txtFund
txtAccount
dtmSupersheetDate
txtStateCode
curAmount


The underlying append queries are not terribly complicated and update the
tables with the previous day data. Your thoughts and responses will be
appreciated.

Thank you.

KC Classic
 
M

Maurice

First we have to know... have you split the db or are we talking about a
single db.
If you have split the db then you'd have to check if the different
switchboards weren't open during the disabling of the button you want to
disable.

Maurice
 
D

Dale Fye

KC,

I usually keep a table of program parameters (tbl_prg_Parameters) in my
back-end database. You could create such a table and add a date field to
that table where you could store the date last updated. Then in your splash
screens load event, you could check to see whether that date was equal to
todays date. If so you could disable the control. When you click the
control to update your tables, then also update this field to indicate todays
date.

That leaves you with the case where another user opens the form, but doesn't
do the update. When you perform the update their command button will still
be enabled. You can overcome this by: 1) putting some code in the click
event to test and see whether the value of that field has changed, and not do
the upload if it has. In which case, you should also disable the control, or
2) You could use the splash screens timer event to check the value of that
field every so often. Once it sees that the updates have been done, change
the timerinterval to zero so it doesn't do the checks any more that day.

HTH
Dale
 
Top