473,385 Members | 2,044 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,385 software developers and data experts.

Force a checkbox to be checked, but allow only one checkbox to be checked

I have an Access 2010 form with 4 checkboxes, along with other fields. On the OnClick event each checkbox sets the value of a field with some text that I use later in a report. However, sometimes users will not check a box or will check 2 boxes, which causes the report text to be incorrect. I want a messagebox to tell them they must check a box if they did not and keep the form open on the same record if they try to close the form or move to another record. However, I also want to clear all check boxes and have a messagebox if they check more than one box. I am not sure which event I need to put the code/macro on or whether to use else or elseif for some of the flow. Or am I on the wrong track completely. Thanks for any assitance.
Jun 5 '13 #1
2 3206
Seth Schrock
2,965 Expert 2GB
I would use an option group and then set it to be required. The option group itself will take care of only being able to select one of the check boxes. To make it required, you would just set the values of the options to be 1 through 4 and then set the validation rule on the option group control to be 1 - 4. This will make the control require a value and it won't allow the form to go to another record or close without a prompt. A custom prompt can be entered in the validation text property.
Jun 5 '13 #2
Rabbit
12,516 Expert Mod 8TB
Why not use radio buttons?
Jun 5 '13 #3

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

Similar topics

0
by: yurps | last post by:
Hello I have a DataList like this <asp:DataList id="Questions" Runat="server"> <ItemTemplate> <table border="1"> <tr> <td> <asp:CheckBox ID="Yes" Runat="server"></asp:CheckBox> <input...
1
by: dx | last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as simple as setting oCheckBox.Checked = True.. yet for some reason it isn't. I have a user control (ascx) that that has a...
4
by: Maarten | last post by:
I have a bound-checkbox. The database value = 0 but the checkbox got checked? Why is that? What value should be in the database for being not checked then? tia
10
by: Bishman | last post by:
Hi, I need to programmatically allow or disallow the selection of multiple checkboxes on a form . At certain times I only want to allow a single selection, at other times I may wish to allow...
1
by: sklett | last post by:
I wasn't sure how to deal with this, but this is what I cam up with. If possible, I'd like a little feedback if there is a better way to deal with a situation where changes in an event handler...
5
by: widevision7 | last post by:
I have a web site that uses the following JavaScript to hide <div> sections: <script type="text/javascript"> function showMe (it, box) { var vis = (box.checked) ? "block" : "none";...
0
acoder
by: acoder | last post by:
Problem Dynamically appended checkbox element does not appear checked despite setting the checked property state to true or "checked". Browser Internet Explorer Example The Javascript code:...
1
by: sva0008 | last post by:
Hi, I want a checkbox in such a way that if it is uncheck the user can check it. but if it is checked the user should not be able to uncheck it . can anyone please help. Regards
6
by: beary | last post by:
This is embarrassing, but I have a form pulling data from mysql using php. Lots of different checkboxes in it. When user checks one or more boxes, all goes well; values are added and db is updated....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.