• Automatically Check the Checkbox & Enter a Date

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Automatically Check the Checkbox & Enter a Date

    Author
    Topic
    #471273

    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

    Viewing 3 reply threads
    Author
    Replies
    • #1241288

      Me.Done = True should check the checkbox.

    • #1241289

      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

    • #1241292

      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.

    • #1241293

      Thanks for the tip. I think I’ll do just that.

      JoeK

    Viewing 3 reply threads
    Reply To: Automatically Check the Checkbox & Enter a Date

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: