|
-
Aug 21st, 2001, 07:22 AM
#1
Thread Starter
Hyperactive Member
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
-
Aug 21st, 2001, 09:21 AM
#2
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.
-
Aug 21st, 2001, 09:32 AM
#3
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:
Dim sSql As String
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
-
Aug 21st, 2001, 03:00 PM
#4
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|