473,503 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I force a yes/no box to become checked if I check another one?

52 New Member
Hello! (MS Access 2007 form)

I have three yes/no (check box) fields for registration:
1. Full year (Sept-May)
2. 1st term (Sept-Dec)
3. 2nd term (Jan-May)

Of course, if they register and pay for the full year, I would like the 1st term and second term check boxes to automatically check themselves off. If they don't, I want to be able to check one or the other or both.

I've tried using an iff:

=IIf([Full Year]=True,-1,0)

but I'm not sure where to put it. If I put it into the Control Source, I lose the ability to check the 1st term or second term box by itself, and also it ceases to be stored with the person (which is important).

I'm sure it's exceedingly simple...any ideas out there?
Jun 24 '10 #1
11 3389
jimatqsi
1,271 Recognized Expert Top Contributor
Put your code in the afterupdate event of the checkbox that controls the other checkbox(es). That way, as soon as that control is updated and you leave the control (tab to the next control) the code is executed.

Jim
Jun 24 '10 #2
Mmmel
52 New Member
Thanks! Tried putting this into the afterupdate:

=IIf([Full Year]=-1,[1st semester]=-1,[1st semester]=0)

I've tried using True, False, Yes, No, everything. Nothing happens. I also tried putting it into the Beforeupdate of the 1st semester box. Nothing happened then either! I'd just be happy if SOMETHING happened, so I could debug!

Sorry to be such a noob...could you dumb it down for me even more? THANKS! : )
Jun 24 '10 #3
jimatqsi
1,271 Recognized Expert Top Contributor
:) Yes, I understand your frustration. It should be
Expand|Select|Wrap|Line Numbers
  1. if me![Full Year] = -1 then
  2.     me![1st Semester] = -1
  3.     me![2nd Semester] = -1
  4. else
  5.  
  6.     me![1st Semester] = 0
  7.     me![2nd Semester] = 0
  8. endif
I'm not so sure about the wisdom of the =0s in the Else, but perhaps that is logically correct for you.

Jim
Jun 24 '10 #4
Mmmel
52 New Member
THANK YOU! THANK YOU! THANK YOU! You're right - there is NO wisdom to putting =0 in the Else. I omitted it. Works perfectly now!

I had just never worked with if's in the Code Builder before, only iif's in the expression builder. Big difference!

Thanks again! I so appreciate it!

Melody
Jun 24 '10 #5
OldBirdman
675 Contributor
I'm not sure I agree with the setup here. Unless there is absolutely no difference between registering for 1st term, then later registering for 2nd term and with registering for both at the same time, I would make these RadioButtons with 1st, 2nd, Both. Only one could be chosen.
If you proceed as you are though, then the code should be:
Expand|Select|Wrap|Line Numbers
  1. me![1st Semester] = me![Full Year] 
  2. me![2nd Semester] = me![Full Year]
This would correctly allow [Full Year] to be unchecked, and each semister would be unchecked also.
Jun 24 '10 #6
Mmmel
52 New Member
Thanks for the feedback! There actually is quite a big difference. If you decide to register for the full year at the outset, you get a cheaper rate. Many members choose to only register in the fall, and then choose (or not) to register again in the winter. In this case, they would have 1st Semester checked, and 2nd Semester Checked, but not Full Year. They end up paying more since they've paid in two installments, if you like. I key my Member Info sheets off of the 1st Semester and 2nd Semester checkboxes, so that I have different lists for each semester, so it is important to track them separately. But, now that it will automagically check 1st Semester and 2nd Semester when I check Full Year, this makes it no more work at all!

I've gone back and forth with just having an "Active Member" checkbox to key my reports off of, but then I can't go back and print out Member Info sheets from last fall, which I'd like to do.

This was my very first database, and one thing I learned is to plan it out well at the outset! (which I probably didn't do as well as I could!). Ahhhh...the old learning curve!
Jun 24 '10 #7
jimatqsi
1,271 Recognized Expert Top Contributor
Melody,
You're in for a lot of fun. The "code builder" is where the action is. I've been programming in Access for 10 years and I learn something nearly every day from posts on bytes.com, so stick around. Read random threads for 15 minutes a day, you'll be surprised how quickly it sinks in.

Jim
Jun 24 '10 #8
Mmmel
52 New Member
@jimatqsi
What a great idea! I've just been bopping around here trying to figure out why Access throws a fit when I import a text file ("Subscript Out of Range"). It all looks so good! Back to the search...
Jun 24 '10 #9
jimatqsi
1,271 Recognized Expert Top Contributor
@Mmmel
You might try Google's advanced search page and specify to search only domain bytes.com. I find that often works better than using the site's search function.

Importing text is usually pretty easy to get it done. Try importing only one column, then add another and another, that might narrow it down some.

Jim
Jun 24 '10 #10
Mmmel
52 New Member
Thanks, Jim! I eventually just gave up and typed in the info (only for four people), but I will work on solving this one.

Cheers!

: )
Jun 30 '10 #11
jimatqsi
1,271 Recognized Expert Top Contributor
Melody, I want you to see this thread
http://bytes.com/topic/access/answer...t-oldest-dates

just to make the point about the value of a few minutes "bopping around" at Bytes.

Jim
Jun 30 '10 #12

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

Similar topics

8
1872
by: John | last post by:
Hey guys, In a form of 3 checkboxes, at least one of them has to be checked. How would I go about making sure at least one is checked before the form is submitted? If it's not checked, an alert...
2
1245
by: Morten Wennevik | last post by:
In the middle to a heavy recursive loop, can you pause and force a message check? -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
0
1980
by: Brian | last post by:
I've got a datagrid with a checkbox column. Everything looks good. I'd like to implement a chcekbox that when checked causes all the checkboxes in the grid to become checked, and vice versa. Any...
1
1747
by: toton | last post by:
In C++ , when the class is declared in the header & not implemented in the cpp, the linker is not giving a error untill the method gets called. How to ensure that all non pure-virtual method...
1
1103
ramprabu
by: ramprabu | last post by:
Hi, In a html page has 6 check boxes all are same id and different values. I will submit the html page it will sumitted to one aspx page. How to get all the checked check box values in...
4
22831
by: haresh.amis | last post by:
hello to all, I m using .net 2.0 and i face a problem that is as under Well I have a checkboxlist which i bound in .cs page now I want to count that how many checkboxes ate checked ( In...
17
4787
by: olivero | last post by:
Hi group, How do I check all check box controls on a Continuous Form? I have a form (Main) with two SubForms (Sub1 and Sub2). Sub1 has a button that is supposed to check all the check boxes...
3
1439
by: burg226 | last post by:
hey all, i'm trying to make an employee directory in a Table with check boxes beside each employees email address. What i want it to do is at the bottom of the directory i want a Button to compile...
1
1507
by: DaveRook | last post by:
Hello How do I display a checked check box list? I have a list which gives options A, B and C. If some one checks A and C and clicks Search, I just want it to write A and C! If some one...
2
2830
by: asymtotes | last post by:
hello n gud day every one basically my project is about personality test, it content 6 page of question which each page has 13 question page 1 ----------------------- question 1 ...
0
7199
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
7074
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
7273
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,...
0
7322
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...
1
6982
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
7451
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
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1501
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.