Day counter

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

Guest

Hello, I want to add a box on a form that counts the days our plant worked
without a lost time accident. Right now we are at 1457 days so the counter
would have to start there. I would also like to add a reset button mabe. How
would this be acomplished?

Thanks,
Chad
 
Hi Chad

Add 2 text boxes (box 1 and Box2) unbound to a form. Add a very big red
button with the word Reset on it.

In the first box (box1) use this as the source
= 19/06/2003
Make this box Visible = No

In the second box (box2) use this as the source
=DateDiff("d",[text0],Date())

On the OnClick event on the big red button
Me.Box1 = Date

Oh all this for box one assumes that you are going the start the whole thing
today 15th June 2007 - if not then change the date in box box to what it
should be


Have fun
 
Sorry I responed to soon. It keeps giving me the same number of days even
when I change the date? This is what I used please see if I did it
correctly...Thanks!

Add 2 text boxes (txtStartDate and txtTotalDays) unbound to a form.

In the first box (txtStartDate) use this as the source
=17/05/2003
Make this box Visible = No

In the second box (txtTotalDays) use this as the source
=DateDiff("d",[txtStartDate],Date())
 
This is correct (source of txtTotalDays)
=DateDiff("d",[txtStartDate],Date())

As it unbound put the default value of txtStartDate as
#17/05/2003#
Format this field as short date
 
Slight improvement

source of txtTotalDays could be

="Total days without a accident " &
Format(DateDiff("d",[txtStartDate],Date()),0)

Up to you this but I think it makes it easier to understand
 
Wayne, Im doing something wrong! I have in txtStartDate box control source
=17/5/2006 formated at short date.

Then in textTotalDays box control source I have ="Total days without a
accident " & Format(DateDiff("d",[txtStartDate],Date()),0)

Now its giving me an answer of (Total days without a accident 0)

Im missing something?Thanks!
 
My mistake I had the name of the text wrong thats why I got a zero. But its
still giving me the wrong number. Its giving me 39,248 the same as it did
before? I want the start date to be July 17th 2003.

Wayne-I-M said:
Slight improvement

source of txtTotalDays could be

="Total days without a accident " &
Format(DateDiff("d",[txtStartDate],Date()),0)

Up to you this but I think it makes it easier to understand

--
Wayne
Manchester, England.



Chad said:
Sorry I responed to soon. It keeps giving me the same number of days even
when I change the date? This is what I used please see if I did it
correctly...Thanks!

Add 2 text boxes (txtStartDate and txtTotalDays) unbound to a form.

In the first box (txtStartDate) use this as the source
=17/05/2003
Make this box Visible = No

In the second box (txtTotalDays) use this as the source
=DateDiff("d",[txtStartDate],Date())
 
I got it I didnt understand what you ment by #17/5/2003# but I tried it in
the control source without the = sign and it gave an error then with and it
gave the right number. Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top