473,804 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checkbox code problem

I need anyone that have done this before to help me. I'm creating a
form in Access, in the form has two two checkbox, checkbox A is paid,
checkbox B is partial_paid. I want the set the checkbox so that if the
user click on checkbox A which is Paid, then checkbox B which is
partial_paid should be disable, visa versa, then if checkbox A which
is Paid is uncheck then checkbox B becomes visible. This is the code
I have so far but when I uncheck checkbox A, checkbox B does not
appear. Please help me.

Private Sub chkPaid_Click()
If chkPaid.Enabled = True Then
chkPartial_Paid .Visible = False
chkPartial_Paid .Locked = False

Else
chkPaid.Enabled = False
chkPartial_Paid .Visible = False
chkPartial_Paid .Locked = True
Nov 12 '05 #1
2 3785
Why not use an option group instead of individual check boxes. That way only
one or the other can be selected at a time!

If you want to use your method though, you don't want to check for enabled
because even when it's not selected it's still enabled just not checked.
What you want to check for is true(-1) or False(0) Like so:

Private Sub chkPaid_Click()
If chkPaid = True Then ' if it's selected it equals true or -1
chkPartial_Paid = False
Else
chkPartial_Paid = True
End Sub

'and use this for chkPartial_Paid
Private Sub chkPartial_Paid _Click()
If chkPartial_Paid = True Then ' if it's selected it equeals true or -1
chkPaid = False
Else
chkPaid = True
End Sub
--
Reggie

www.smittysinet.com
----------
"Kufre" <ku*******@hotm ail.com> wrote in message
news:47******** *************** ***@posting.goo gle.com...
I need anyone that have done this before to help me. I'm creating a
form in Access, in the form has two two checkbox, checkbox A is paid,
checkbox B is partial_paid. I want the set the checkbox so that if the
user click on checkbox A which is Paid, then checkbox B which is
partial_paid should be disable, visa versa, then if checkbox A which
is Paid is uncheck then checkbox B becomes visible. This is the code
I have so far but when I uncheck checkbox A, checkbox B does not
appear. Please help me.

Private Sub chkPaid_Click()
If chkPaid.Enabled = True Then
chkPartial_Paid .Visible = False
chkPartial_Paid .Locked = False

Else
chkPaid.Enabled = False
chkPartial_Paid .Visible = False
chkPartial_Paid .Locked = True

Nov 12 '05 #2
You need to check the Value of chkPaid, not its Enabled status. If you can
click it to check/uncheck it, then it is enabled. Also, there is no need to
lock a hidden control. It doesn't hurt anything, it just doesn't accomplish
anything. If the user can't see it, they can't do anything to it. It may
also be nicer for the user to just Enable/Disable (grayed out/not grayed
out) chkPartial_Paid rather than hiding and unhiding it (personal
preference).

If chkPaid = True Then

--
Wayne Morgan
Microsoft Access MVP
"Kufre" <ku*******@hotm ail.com> wrote in message
news:47******** *************** ***@posting.goo gle.com...
I need anyone that have done this before to help me. I'm creating a
form in Access, in the form has two two checkbox, checkbox A is paid,
checkbox B is partial_paid. I want the set the checkbox so that if the
user click on checkbox A which is Paid, then checkbox B which is
partial_paid should be disable, visa versa, then if checkbox A which
is Paid is uncheck then checkbox B becomes visible. This is the code
I have so far but when I uncheck checkbox A, checkbox B does not
appear. Please help me.

Private Sub chkPaid_Click()
If chkPaid.Enabled = True Then
chkPartial_Paid .Visible = False
chkPartial_Paid .Locked = False

Else
chkPaid.Enabled = False
chkPartial_Paid .Visible = False
chkPartial_Paid .Locked = True

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2339
by: Tomas Vera | last post by:
Hello All, I'm having problems creating a page with dynamic checkboxes in a WebApp. In my app, I need to query a database, then (based on results) add checkboxes to my form and set their "Checked" state. Since the controls are dynamically created, I'm using the OnInit event to create the checkboxes and set the "Checked" state from the DB. Next, I want to capture the postback event (AutoPostBack=true) and update my database based on...
2
11801
by: Thomas R | last post by:
Is is possible? In VS.NET 2003, Binding data to the repeater is easy, but when I try to add an ASP:checkbox to the .aspx page, the designer won't recognize it, hence the code view doesn't allow me to access it. The funny thing is that it compiles fine, and the checkboxes are there, I just can't write to them! Is there a way around this problem? My HTML is as follows:
0
2408
by: mike | last post by:
Hi there: I've read an excellent "how to"-article by Microsoft (no. 306227) - partly cited cited at the end of this email). I have implemented the code related to the part "How to Add a CheckBox Programmatically" in my code. I have changed it to use a OLDDB.DBReader to populate the datagrid and for the databinding. It works perfectly - also when using the edit-mode in the datagrid.
5
3673
by: DotNetJunkies User | last post by:
1. i want to populate checkboxlist using javascript only at client side ....how can i do this..by populate word i mean that checkboxes should be checked or unchecked on some condition basis.... 2. after population there should be validation in checkboxlist..... that is if user clicks a button wihout checking any one of them(i.e. at least one shuld be checked) ... alerat message shouls come on the form....... these 2 steps should be...
6
2058
by: Francois | last post by:
Hi, I am trying to implement a custom control that extends the standard System.Web.UI.WebControls.CheckBox control. In the .Net class library reference it is said that CheckBox Implements IPostBackDataHandler interface. I want to override the 2 methods defined by that interface but i do not see in the CheckBox class that the methods of IPostBackDataHandler are implemented. But they should be as the class is said to implement the...
1
4516
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 checkbox and I can't get it to default to checked. I tried radiobuttons and experienced the same result.. can't start them as checked. The really frustrating thing is that I set the attributes of other input controls in the Init() with no problem. ...
4
3952
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several textboxes and a checkbox. The behaviour I want from my app is as follows:- When the textbox (which is prior in tab order to the tab control) has been filled with a certain length of text by the user, the focus is
34
3841
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript function needs to run and validate all the checkboxes on my form and make sure none of them are unchecked. I suck at Javascript and my problem is 2fold. I have the following code that constructs the checkbox response.write "<input type=checkbox...
0
4105
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
4
4441
by: Charlotte | last post by:
Hi, I have a problem with a ASP-script, can somewone help me ? here is what I've got: mypage.asp : .... code ... <%
0
9708
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
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
10588
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
10340
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
7623
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
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
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
4302
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
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.