473,657 Members | 2,515 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 3401
jimatqsi
1,276 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,276 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,276 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,276 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

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

Similar topics

8
1879
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 pops up saying at least one has to be checked. Thanks in advance!
2
1256
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
1984
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 ideas on how to do this? The following code does not work: Dim iRow As Integer Dim myView As DataView
1
1756
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 declared is implemented, even when the method/member function not getting called. Any linker checking can be performed for this purpose? How can a template class can be splitted in header & source? And to ensure every method is having an...
1
1111
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 asp.net? Regards WTI Software Engineer
4
22842
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 javascript ) and checked checkboxes text will be concat and that string will be pass on to report query I m trying on by this code but it's not work
17
4812
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 visible in the SourceObject of Sub2. The SourceObject of Sub2 is a Continous Form based on a query. I need to be able to click the button and have all the check boxes become checked. Right now, I can only get teh first one to check!
3
1444
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 all of the checked check boxes and enter those email addresses in a new email document using a mailto command. Any ideas? I'm sure i have seen something similar done before. I would prefer to keep it in HTML if possible as i am a very junior...
1
1518
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 checks B and clicks Search, I just want it to write B! My code doesn't work (it can't convert from Char to String)
2
2838
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 checkbox1 question 2 checkbox2 .
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
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 we have to send another system
2
1953
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.