Auto update of a field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Not sure if this is the correct section to post, but I can't find any on VBA,
so I guess this is the most appropriate section.

I have a table with the following 2 fields, ExpiryDate and Qty.

I need a code or macro to run everyday, to compare the ExpiryDate and the
current date to determine if the product has expired. If the product has
expired, the Qty will be updated to 0.

What I need to know is how to make the code runs on its own.

How to compare the ExpiryDate field to the current date for all records? I
guess using loops is a must. But I need to know the syntax for it. Have no
idea how to do the counter variable.

Thank you for all the time and trouble.
 
Create a macro named Autoexec. In the macro have it open an update query.
The update query will have =Date() as criteria for your ExpiryDate field.
NOTE - If your ExpiryDate has a time component then strip it off be using --
CVDate(Int([ExpiryDate]))
 
Back
Top