Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Jerusalem, Israel
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, All.

    In my Access 2007 task-tracking database I have a checkbox called "Done", indicating that the task is done and I have a field called "Date_Done", which records the date on which the task was done. The purpose of the code is to automatically check the "Done" checkbox and fill in the date when one of the statuses listed in the code, below, is selected in the "Status" field (combo box). The following code runs on the "On Change" event of the "Status" combo box. The date fills automatically but the checkbox doesn't check itself automatically and I can't figure out why:

    Code:
    If Me.Status = "Completed" Or Me.Status = "Released" Or Me.Status = "Cancelled" Then
    Me.Done = "Yes"
    Me.Date_Done = Date
        Else
        End If
    Any help is appreciated.

    Thanks,

    JoeK

  2. #2
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Me.Done = True should check the checkbox.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Jerusalem, Israel
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks. I implemented your change, but it didn't help at first.

    Then I moved the code to the after update event, and it worked. I wonder why it didn't work on the on change event?

    I added similar code to the after update event to clear the date done and the done checkbox if the user changes their mind and selects a different status.

    Much appreciated,

    JoeK

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I would just get rid of the checkbox altogether (and this is a decision I have made many, many times). A task is done if there is a date in Date_Done, and it is not done if there is no date.
    Having both is redundant.

    If you like to see the checkbox on the form , set its control source to:
    Code:
    =not isnull([date_done])
    Then it is not a stored field, but just displayed on the screen.
    Regards
    John



  5. #5
    2 Star Lounger
    Join Date
    May 2002
    Location
    Jerusalem, Israel
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the tip. I think I'll do just that.

    JoeK

Posting Permissions

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