Results 1 to 4 of 4

Thread: clear a check box

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2001
    Posts
    302

    clear a check box

    Hello,

    How do I clear a checkbox from all records in a table, using a botton in a form?

    I know that I have to create a recordset and check if the box is -1, if it is set it to 0...

    Can you help?



    thank you

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    What do you mean by "clear a checkbox from all records in a table"

    How do records in a table get a check box by them? It would seem they would need to be displayed on some type of control on a VB Form. If this is the case, then clearing the checkboxes would be easy using a For Each/Next loop.

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    He probably has a field of boolean values.

    You don't have to create a Recordset.
    You could use an UPDATE SQL statement that looks a bit like this:
    VB Code:
    1. Dim sSql As String
    2. sSql = "UPDATE [i]TableName[/i] SET [i]ColumnName[/i] = 0 WHERE [i]ColumnName[/i] = -1"
    I don't know if you use ADO or DAO but if you use DAO simply pass the above SQL statement to the Execute method of a Database object.
    If you use ADO use the Execute method of a Connection object instead.

    Best regards

  4. #4
    Junior Member
    Join Date
    Aug 2001
    Posts
    20
    the problem is that with a recordset, it will go through every record in that table... If you have a lot of records, it can take a few seconds!

    I don't know if there is a simpler and faster way!

Posting Permissions

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



Click Here to Expand Forum to Full Width