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

Toggling Checkboxes

I am trying to set up a pair of checkboxes where only one may be
checked at a time BUT both should be able to unchecked as well. Thus
an option group does not work as at least one value will always be
true.

I tried:

Private Sub chkRMA_Click()
chkRMAOther = False
End Sub

Private Sub chkRMAOther_Click()
chkRMA = False
End Sub

I found that when I set the opposite checkbox value, I call its event
as well, thereby setting both to false.

Any suggestions?

Nov 13 '05 #1
6 3908
<sm***********@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
I am trying to set up a pair of checkboxes where only one may be
checked at a time BUT both should be able to unchecked as well. Thus
an option group does not work as at least one value will always be
true.

I tried:

Private Sub chkRMA_Click()
chkRMAOther = False
End Sub

Private Sub chkRMAOther_Click()
chkRMA = False
End Sub

I found that when I set the opposite checkbox value, I call its event
as well, thereby setting both to false.

Any suggestions?


I'm pretty sure that changing the setting of another control does NOT fire
that control's event. Yet I see a flaw in your logic. Remember that the
control is checked when you click it, but then it becomes unchecked when you
click it again. So if you click it a 2nd time it will become unchecked and
the other control will become unchecked, too.

Instead, try using the AfterUpdate event. Such as (air code):

Private Sub chkRMA_AfterUpdate()
If Me.chkRMA = True
Me.chkRMAOther = False
Endif
End Sub

Private Sub chkRMAOther_AfterUpdate()
If Me.chkRMAOther = True
Me.chkRMA = False
Endif
End Sub

Fred Zuckerman
Nov 13 '05 #2
Private Sub chkRMA_Click()
If chkRMA = True Then
chkRMAOther = False
End If
End Sub

Private Sub chkRMAOther_Click()
If chkRMAOther = True Then
chkRMA = False
End If
End Sub

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

<sm***********@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
I am trying to set up a pair of checkboxes where only one may be
checked at a time BUT both should be able to unchecked as well. Thus
an option group does not work as at least one value will always be
true.

I tried:

Private Sub chkRMA_Click()
chkRMAOther = False
End Sub

Private Sub chkRMAOther_Click()
chkRMA = False
End Sub

I found that when I set the opposite checkbox value, I call its event
as well, thereby setting both to false.

Any suggestions?

Nov 13 '05 #3
rkc
sm***********@yahoo.com wrote:
I am trying to set up a pair of checkboxes where only one may be
checked at a time BUT both should be able to unchecked as well. Thus
an option group does not work as at least one value will always be
true.

I tried:

Private Sub chkRMA_Click()
chkRMAOther = False
End Sub

Private Sub chkRMAOther_Click()
chkRMA = False
End Sub

I found that when I set the opposite checkbox value, I call its event
as well, thereby setting both to false.


Really? I can't make that happen. What you have works fine for me.
What aren't you telling us?
Nov 13 '05 #4
if you set it up as an option group, you could leave the default value
for the group unset and skip all the setting and unsetting via if
functions. that may not work for you since once checked, some value
will always be set for the option group. you could unset the option
group programatically however by simply erasing the Value property
associated with it.

Nov 13 '05 #5
I stepped through it in debug mode and when I changed the value on the
other check box it took me to it's click event. Surprised me, too.
Running Visual Studio 6.0 in WIN 2000.

Nov 13 '05 #6
rkc
mathilda wrote:
I stepped through it in debug mode and when I changed the value on the
other check box it took me to it's click event. Surprised me, too.
Running Visual Studio 6.0 in WIN 2000.


O.K. So your using VB6 not Access for frontend development.
The Access checkboxes don't act like what you described.

Did you come up with a solution to this yet?
Nov 13 '05 #7

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

Similar topics

2
by: Pete | last post by:
There is a Summary/Example further down... On page one of my site I have a form with some checkboxes and detailed descriptions. When the form is submitted (to page two), the values of the...
6
by: Dr John Stockton | last post by:
I see, quite often, code like if (tmp.style.display == 'none') tmp.style.display = 'block'; else if (tmp.style.display == 'block') tmp.style.display = 'none'; or if (tmp.style.display ==...
6
by: terence.parker | last post by:
I currently have the following JS in my header: function checkall(thestate) { var checkboxes=eval("document.forms.EssayList.file_id") for (i=0;i<checkboxes.length;i++)...
1
by: siaj | last post by:
Hello all,, I want to have a page where I can have two images shown alternately in a image control. The image should keep toggling Any link or sample code will be appreciated.
1
by: Jesse Aufiero | last post by:
I have an MDI application with two maximized child forms. At any given time only one of the child forms is in the foreground and visible. To alternate between the two child forms, I can type...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
5
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: ...
8
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the...
7
by: viki1967 | last post by:
I need one function javascript that: 1) when I enter in this htm page I see enabled only checkbox of categories A, M and T; checkboxes of microcategories all disabled; 2-a) If I select the...
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.