Expire Entry

  • Thread starter Thread starter Rod
  • Start date Start date
R

Rod

Hello,

I have one that is not very tough but as a beginner in programming I am
having a tough time with it. Upon opening the form I would like to

1) scan tblCandidates.Entry
2) if .Source = 1 and .Entry is older than 14 days and .Archive is not set
then set .Archive to be Date

..Archive and .Entry are of data type Date
..Source is of data type number.

Thanks
 
If you are doing it upon opening a form, the easiest way is to build a
recordset, then using the criteria from the recordset in conditional (if
then else) statements, edit the recordset. That is inefficient because you
must walk through the recordset. A much more efficient way is to run an
update query with the criteria you mentioned. While it can be done when
opening a form, it is probably more efficient to do it upon a button click.
 
OK, I like the thought, however, I can not count on someone to press the
button. I need to automatically age these old record out when the form is
loaded. I already have a procedure for Form_Load. How can I "Call" this
query from within Form_Load?

Thanks.
 
Write the recordset code in the form's load event, or if it's an Action
Query you can code it like:

CurrentDb.Execute "Update ... "

or if a saved query, something like:

DoCmd.OpenQuery "QueryName"
 
Back
Top