472,336 Members | 1,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 3697
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*******@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
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*******@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
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
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...
2
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...
0
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...
5
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...
6
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...
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. ...
4
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...
34
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...
0
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...
4
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
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

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.