Results 1 to 7 of 7

Thread: checkbox

  1. #1
    Join Date
    Sep 2002
    Posts
    79

    Unanswered: checkbox

    Does anyone know a code for once a command button is pushed, it clears a checked checkbox?

    Not just in the current record, but all records in the database. But only one specific check box.

    so lets say I have a command buttoned named “Command1” and a checkbox named “check1”

    I want by a single push of “Command1” to clear “check1” in all records.

    Any help would be appreciated.

  2. #2
    Join Date
    Oct 2002
    Location
    Sao Paulo - Brazil
    Posts
    16
    Hi alex8111,

    You have many ways to do that. I belive you have a tbale with a boolean field (yes/Not) for source of checkbox. I believe the easy way is:

    docmd.runsql "UPDATE [YourTable] SET [FieldofCheckBox] = false"

    Be carefull! Thats updates (clean) all records of table. Is better to make some criteria, if you don´t want it.
    Regards,

    Rogerio

  3. #3
    Join Date
    Sep 2002
    Posts
    79
    I tried that code and it didnt work...

  4. #4
    Join Date
    Oct 2002
    Location
    Sao Paulo - Brazil
    Posts
    16
    hi Alex,

    Some message error?
    Regards,

    Rogerio

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Yes, that should work if your datatype is YES/NO. What datatype are you using for the checkbox column in your table ?

  6. #6
    Join Date
    Sep 2002
    Posts
    79
    Sorry guys im just not good with visual basic.

    The name of the command button is "command01" and the name of the checkbox is "check114" and the checkbox is Yes/NO. Also, the name of the table is "Tape Log".

    Could someone please give me the code not with the names i have provided.

    Sorry for the inconvenience.

    I do appreciate it.

  7. #7
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    91
    Inside the command01_click, put:
    DoCmd.RunSQL "UPDATE [Tape Log] SET [FieldOfCheckbox] = False"

    Maybe you misunderstand about FieldOfCheckBox. FieldOfCheckBox is not the name of checkbox. It is the field name inside your table.

Posting Permissions

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