Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2003
    Posts
    4

    Unanswered: Countdown to an Event

    I want to insert a field in a form to countdown the days
    until an event occurs. I want the field to show how many
    days until the last event expires. For example.

    Joe Snuffy performed this task on 1-Jan-03. He has 90
    days until he has to perform that task again. If today is
    3-Jan-03 he has 88 days until that event has to be
    accomplished again. I want the field to automatically
    calculate and show the 88 days.

    If you know how, please help.

    Thanks very much,

    david.

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    be primitive!
    try:

    CountdownDisplayTextBox.value = int(TargetDate - Date())

    izy

  3. #3
    Join Date
    Sep 2003
    Posts
    4
    THANK YOU SOOOO MUCH!

    That is what I needed. Now I just need to tweak it a little bit. What I did was

    =int(Date()-[DueDate])

    That gave me the number. The only problem is, that when they are still within the time period to accomplish the task, then it shows a negative number. When they're past they're due date, it shows a positive number. Is there any way of changing this to show the negative number for post due date, and show a positive number for the pre due date? I know this is picky, but I understand it, but others that I work with might not.

    Also is there a way to change the color of the number if they're past their due date to red? Say they're within their qualification time, then it would be a black positive integer, and if they're past their qualification date, then it would be a negative red number.

  4. #4
    Join Date
    Dec 2002
    Posts
    60
    Another way is to use DataDiff function.

    As for changing colors, try something like:
    If value>0 then me.txtdatefield.forecolor=255

  5. #5
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    the -ve sign is toooo easy:
    =int([DueDate]-date())

    easy izy

  6. #6
    Join Date
    Jul 2002
    Location
    Romania
    Posts
    122
    The red/black colour thing:

    Private Sub Form_Current()
    Me.TextboxName.ForeColor = -255 * (Me.TextboxName<0)
    End Sub
    (this is not applicable to continuous forms)

    or conditional formatting if you have Access 2000/XP

    Good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •