By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,081 Members | 1,885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,081 IT Pros & Developers. It's quick & easy.

How to uncheck the check boxes in a single click

P: 36
I have hundreds of records in my database. Each has a check box. Is there any option to select or unselect all those check boxes in single click?. Please suggest.
Jan 18 '10 #1
Share this Question
Share on Google+
11 Replies

Expert 2.5K+
P: 3,532
Is this a one time thing you're looking to do or will you want to reset them on all records on a regular basis?

Welcome to Bytes!

Linq ;0)>
Jan 18 '10 #2

P: 36
The purpose of this is to select the questions from a question bank, to prepare a question paper. To generate a new one, present, I am doing it manually. Frequently I have to select or unselect the records.
thank you
Jan 18 '10 #3

Expert Mod 100+
P: 2,321
Ups, Ill post some code later, thought I had it here. I will find it and get back to you.
Jan 18 '10 #4

Expert 2.5K+
P: 3,072
Use an update query for (re-)setting the field like:
Expand|Select|Wrap|Line Numbers
  1. UPDATE tblA
  2. SET YesNo_field =  True
  3. or
  4. UPDATE tblA
  5. SET YesNo_field =  False
By using:
Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("UPDATE tblA SET YesNo_field =  False")
in a procedure behind a button or in the OnCurrent event of a form you can do this automatically.

Jan 18 '10 #5

P: 36
Being a beginer I failed to enter the code given by you. please tell me how to enter the above code step by step.
My db name is question bank, query name is paper settingThank you
Jan 23 '10 #6

Expert 2.5K+
P: 3,072
1) Create a form not linked to a table
2) Create a new button and set the name to: "btnReset"
3) Create a subform using your query "paper setting" as the recordsource
4) Open the Events tab of the properties of the "btnReset" and double-click the "OnClick" text to get a "Procedure" text after the text.
5) Click on the [...] button behind the "Procedure" text to go into the VBA code
6) Enter where the cursor is located:
Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("UPDATE [paper setting] SET YesNo_fieldname =  False")
  2. Me.requiry
Save the form and test.

Btw I would never use spaces in table or query names and starting a table wit "tbl" and queries with "qry" is advisable and a lot easier in the future.
Further you should better use the original table instead of a query to operform the UPDATE on. All needed in the above code is to replace the YesNo_fieldname with your fieldname (and preferable switch to using the table i.s.o. the query and thus change the subform's recordsource and update query to the tblName.

Jan 23 '10 #7

P: 36
getting error in the second line ( Me.requiry)
Jan 23 '10 #8

P: 10

Amend it to:

Jan 23 '10 #9

Expert 2.5K+
P: 3,072
Sorry for the typo.
When typing the dot after Me it's enough to type "req" and press [Tab] to append the correct property.

Jan 23 '10 #10

P: 36
This time I got a run-time error '3061'
Too few parameters.Expected 1.
Jan 24 '10 #11

Expert 2.5K+
P: 3,072
Then a field name in your UPDATE query isn't entered correctly.
Make sure it's the name of the field in the table/query.

Jan 24 '10 #12

Post your reply

Sign in to post your reply or Sign up for a free account.