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

How to uncheck the check boxes in a single click

mb60
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.
Thanks.
Jan 18 '10 #1
Share this Question
Share on Google+
11 Replies


missinglinq
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

mb60
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

TheSmileyCoder
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

nico5038
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
  6.  
By using:
Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("UPDATE tblA SET YesNo_field =  False")
  2.  
in a procedure behind a button or in the OnCurrent event of a form you can do this automatically.

Nic;o)
Jan 18 '10 #5

mb60
P: 36
@nico5038
Sir
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

nico5038
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
  3.  
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.

Nic;o)
Jan 23 '10 #7

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

P: 10
Hi

Amend it to:

Me.requery
Jan 23 '10 #9

nico5038
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.

Nic;o)
Jan 23 '10 #10

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

nico5038
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.

Nic;o)
Jan 24 '10 #12

Post your reply

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