Add 1 Each time

DemonHub

Registered User.
Local time
Today, 01:25
Joined
Jul 26, 2005
Messages
14
I made a button with a click event and in this event I want to add 1 to "Days of waiting" for each rows in a table with waiting in the field "Status" , each time I click on the button.

I don't know how to go in the table with VBA code and add 1 to the rows with the criteria.

The button is not push in the week-end so I can't do something that add 1 every day.But if something is done automaticly every day except Saturday and Sunday without pressing a button , this thing is probably better but I don't know how to do that either.

If you find a way to do that or something else , your help will be fantastic.
 
Demon,

This will update the data for your button.

Code:
DoCmd.RunSQL "Update YourTable " & _
             "Set [Days of waiting] =  [Days of waiting] + 1 " & _
             "Where [Status] = 'Waiting'"

For a more long-term solution, you can use the Windows Scheduler to
open your DB and execute the code on a periodic basis.

For the real long-term solution, I'd imagine that you shouldn't have
the field [Days of waiting] in the first place. It sounds like it can
easily be calculated using the DateDiff function for the records with
[Status] = 'Waiting'.

Wayne
 

Users who are viewing this thread

Back
Top Bottom