
Originally Posted by
Jayfaas
Hello,
I have a calibration database at work that I use to keep track of the calibration for tools in the warehouse, and the fields consist of ID number, Status(Active, Inactive), Due Date, Last Date, etc. I want to be able to set the Status field to be able to change it to inactive if the Due Date exceeds the current date. IE If the due date is 4/4/2012, and the current date goes past that (4/5/2012 -), I would like the status to change to inactive. We have an active query, and an inactive query, but right now we are having to go back in and change the status manually to inactive when we know its past due, but we have over 100 items to keep track of, and it would just be easier if it did it automatically. So is there a way I can do "IF Date < current date, make active. Else, inactive (or IF Date > current date, make inactive). Please help.
All you have to do is execute an Update query when the database is opened each day.
Something like (air code):
Code:
UPDATE TableName SET [Status] = "Inactive" WHERE [Due Date] < Date()
If the due date is equal to today, do you want the status set to Inactive? If so, change "<" to "<=".
If you have a startup (main, switchboard) form, try it in the Form load event. Or you could have a button on the form. Many ways to execute the code.