Need to auto update data

edster

Registered User.
Local time
Today, 01:10
Joined
Sep 25, 2004
Messages
31
I'm a bit stuck so any help happily recieved. I have a database where a list of products each have individual expiry dates. I also have a check box field for each called "expired".

I need a way of automatically setting the check box value to true if the expiry date comes within 30 days of the present date. The code/macro will have to go through all the records and update them accordingly.

I remember having done it before by multilayering macros (why do they have an 8 run limit!!) but at the time it seemed a bit clunky to say the least.

It seems simple but i cant seem to get it to work!

Cheers

Ed
 
You can attach this to a button:

Private Sub Yourbuttonname_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE yourtable SET yourtable.yourfield = true WHERE " & _
"(((yourtable.yourtabledatefield)>=date()-30));"
DoCmd.SetWarnings True
End Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom