473,411 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

multiple selection of check box

I would like to know how i can make a multiple selection check box for e.g. like yahoo in box if you select or deselect the header check box all the below check boxes are checked or unchecked.

In access 2007 I have one form connected to one table with a field name Present and that field have check box Yes/No, if an employee is present i will check for him and if he is absent i will uncheck, it is big job if i have hundreds of employees to track their attendance, i have created on check box on the header of the form and i want to select or deselect all the check boxes when i select or deselect the header check box.

I would greatly appreciate if someone please help me on this

many thanks

best regards,
Apr 7 '10 #1
4 7890
TheSmileyCoder
2,322 Expert Mod 2GB
You could connect an update query to the checkbox (or button). That is what I would do. Whether you want to do this by macro, or code, depends on your VBA skills.

If you need help with a VBA solution, you need to give some more information on your table structure, and your layout.
Apr 7 '10 #2
ADezii
8,834 Expert 8TB
Let's assume that your Main Check Box is named chkPresent. The following code, in the AfterUpdate() Event of chkPresent, will Check/Uncheck all Check Boxes on your Form depending on whether or not chkPresent is Checked. Is this what you are looking for?
Expand|Select|Wrap|Line Numbers
  1. Private Sub chkPresent_AfterUpdate()
  2. Dim ctl As Control
  3.  
  4. For Each ctl In Me.Controls
  5.   If ctl.ControlType = acCheckBox Then
  6.     If ctl.Name <> "chkPresent" Then
  7.       ctl.Value = Me![chkPresent].Value
  8.     End If
  9.   End If
  10. Next
  11. End Sub
Apr 8 '10 #3
Dear Sir,
Foremost, many thanks for the prompt reply, i tryed this code in afterupdate event of my main checkbox but it checks only the cehck box which got the focus

here is my table sturcture design

StudentID - AutoNumber
EmpID-Number
StudentName - Text
TempAttendance-Yes/No
OT-Text

would apprecaite again some more help on this

with kind and best regards,
Apr 8 '10 #4
TheSmileyCoder
2,322 Expert Mod 2GB
In the afterUpdate event of the checkbox:
Expand|Select|Wrap|Line Numbers
  1. Docmd.SetWarnings(False)
  2.   Docmd.Runsql("UPDATE tbl_Students SET TempAttendance = " & Me.ChckBox);
  3. Docmd.SetWarnings(True)
  4.  
Note that this will set the TempAttendence field for ALL records in teh table. If you need to only do it for some records, you will need to add a WHERE clause.
Apr 8 '10 #5

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

Similar topics

13
by: jing_li | last post by:
Hi, you all, I am a newbee for php and I need your help. One of my coworker and I are both developing a webpage for our project using php. We have a copy of the same files in different location...
1
by: Polar | last post by:
I have a listbox with 5 options. I have set it up to be able to choise more than one option. What I need to know is how to get all the selection into the one string that is stored in the DB ...
2
by: DK | last post by:
Hello everybody ! I need little help from Your side. I have form called Form2, and ListBox called List 20. Property of List 20 allow multiple selection. Also I have query called Distribution as...
10
by: ads | last post by:
hi, after binding the dropdownlist to a datasource, ive experience this error "Cannot have multiple items selected in a dropdownlist" after using the code:...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
18
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and...
2
by: permander kumar | last post by:
hi plz help me, i have a code in which two multiple selection dropdown list. in first list if I am select single value the data are fetch in second table on button click. but the problem is in...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
6
by: phpnewbie26 | last post by:
My current form has one multiple select drop down menu as well as few other drop down menus that are single select. Originally I had it so that the multiple select menu was first, but this created...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.