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
Printable View
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
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.
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:
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.VB Code:
Dim sSql As String sSql = "UPDATE [i]TableName[/i] SET [i]ColumnName[/i] = 0 WHERE [i]ColumnName[/i] = -1"
If you use ADO use the Execute method of a Connection object instead.
Best regards
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!