Results 1 to 5 of 5

Thread: Checkbox (2003)

  1. #1
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Checkbox (2003)

    I have put a checkbox on a form, which when checked, fills in another control. This works ok, but when I go to a new record, the checkbox appears to be checked, but the associated control is blank (as it should be). How do I prevent the checkbox from appearing checked?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Checkbox (2003)

    I assume that the check box is unbound, i.e. its control source is blank? If so, put code in the On Current event of the form to clear the check box:

    Private Sub Form_Current()
    Me.NameOfCheckBox = False
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Checkbox (2003)

    That does clear the checkbox for the next record, but if I go back to the previous record, it is unticked again, although the control I wanted it to fill, remains filled.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Checkbox (2003)

    Try this then:

    Private Sub Form_Current()
    Me.NameOfTheCheckBox = Not IsNull(Me.NameOfOtherControl)
    End Sub

    with the appropriate names substituted.

  5. #5
    5 Star Lounger
    Join Date
    May 2003
    Location
    Sheffield, Yorkshire
    Posts
    951
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Checkbox (2003)

    Thanks Hans. That's done the trick.

Posting Permissions

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