473,657 Members | 2,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Toggle between two checkboxes on a form

I have two checkboxes on a form, ChckIBCCP and ChckOtherReferr al.

Each checkbox highlights its respective textboxes and combo boxes on
the form.

Many of the highlighted textboxes and combo boxes are the same for
either checkbox selected.

Some of the highlighted textboxes and combo boxes differ depending
upon which checkbox is selected.

I am unable to toggle between the two differing effects caused by
clicking each respective checkbox.

For example when I click on the second checkbox, ChckOtherReferr al,
the highlighted textboxes and combo boxes associated with clicking on
this checkbox remain highlighted even after I click on the first
checkbox, ChckIBCCP!?

Can you help me?

Here is my code if it helps?

Private Sub ChckIBCCP_Click ()
Dim ctl As Control

For Each ctl In Me.Controls
If ctl.Tag = "Shadow1" And ChckIBCCP = True _
And ctl.ControlType = 109 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acTextBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckIBCCP = True _
And ctl.ControlType = 111 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acComboBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckIBCCP = True _
And ctl.ControlType = 106 Then
ctl.SpecialEffe ct = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffe ct = 1
End If
Next
End Sub
Private Sub ChckOtherReferr al_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
And ctl.ControlType = 109 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acTextBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
And ctl.ControlType = 111 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acComboBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
And ctl.ControlType = 106 Then
ctl.SpecialEffe ct = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffe ct = 1
End If
Next
End Sub
Thanks!,

John
Jul 1 '08 #1
4 3347
I won't even try to wade thru all of your code, but basically, at the
beginning of each of your click events, step thru each of your controls,
regardless of their tag properties, and set them to the un-hilighted colors,
then format according to the checkbox that is True..

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200807/1

Jul 2 '08 #2
As far as I can tell you're doing the same code in both scenarios. The
only difference is that you're testing a different checkbox each time.
And since you just checked that box "True" then your code returns would
return the same result each time.

By the way, is there a reason you don't want to use an option group?
This seems like exactly the kind of scenario that would apply. Instead
of two procedures you could write one like this:

Private Sub optIBCCP_or_Oth er_AfterUpdate( )
Select Case Me.optIBCCP_or_ Other
Case 1 'IBCCP
'Dehighlight the "Other" fields
'Highlight the IBCCP fields
Case 2 'Other
'Dehighlight the IBCCP fields
'Highlight the "Other" fields
End Select
End Sub

Hope that helps,

Carlos

zufie <jo***********@ illinois.govwro te in news:8ac70202-0a94-45cc-a4ea-
29**********@x3 5g2000hsb.googl egroups.com:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferr al.

Each checkbox highlights its respective textboxes and combo boxes on
the form.

Many of the highlighted textboxes and combo boxes are the same for
either checkbox selected.

Some of the highlighted textboxes and combo boxes differ depending
upon which checkbox is selected.

I am unable to toggle between the two differing effects caused by
clicking each respective checkbox.

For example when I click on the second checkbox, ChckOtherReferr al,
the highlighted textboxes and combo boxes associated with clicking on
this checkbox remain highlighted even after I click on the first
checkbox, ChckIBCCP!?

Can you help me?

Here is my code if it helps?

Private Sub ChckIBCCP_Click ()
Dim ctl As Control

For Each ctl In Me.Controls
If ctl.Tag = "Shadow1" And ChckIBCCP = True _
And ctl.ControlType = 109 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acTextBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckIBCCP = True _
And ctl.ControlType = 111 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acComboBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckIBCCP = True _
And ctl.ControlType = 106 Then
ctl.SpecialEffe ct = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffe ct = 1
End If
Next
End Sub
Private Sub ChckOtherReferr al_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
And ctl.ControlType = 109 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acTextBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
And ctl.ControlType = 111 Then
ctl.BackColor = 16777215
ElseIf ctl.Tag = "" And ctl.ControlType _
= acComboBox Then
ctl.BackColor = 65535
End If
If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
And ctl.ControlType = 106 Then
ctl.SpecialEffe ct = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffe ct = 1
End If
Next
End Sub
Thanks!,

John
Jul 2 '08 #3
On Jul 1, 8:40*pm, "Carlos Nunes-Ueno" <sulla...@athot maildot.com>
wrote:
As far as I can tell you're doing the same code in both scenarios. *The
only difference is that you're testing a different checkbox each time. *
And since you just checked that box "True" then your code returns would
return the same result each time.

By the way, is there a reason you don't want to use an option group? *
This seems like exactly the kind of scenario that would apply. *Instead
of two procedures you could write one like this:

Private Sub optIBCCP_or_Oth er_AfterUpdate( )
* * Select Case Me.optIBCCP_or_ Other
* * * * Case 1 'IBCCP
* * * * * * 'Dehighlight the "Other" fields
* * * * * * * * 'Highlight the IBCCP fields
* * * * Case 2 'Other
* * * * * * 'Dehighlight the IBCCP fields
* * * * * * * * 'Highlight the "Other" fields
* * End Select
End Sub

Hope that helps,

Carlos

zufie <john.marru...@ illinois.govwro te in news:8ac70202-0a94-45cc-a4ea-
2921b46f2...@x3 5g2000hsb.googl egroups.com:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferr al.
Each checkbox highlights its respective textboxes and combo boxes on
the form.
Many of the highlighted textboxes and combo boxes are the same for
either checkbox selected.
Some of the highlighted textboxes and combo boxes differ depending
upon which checkbox is selected.
I am unable to toggle between the two differing effects caused by
clicking each respective checkbox.
For example when I click on the second checkbox, ChckOtherReferr al,
the highlighted textboxes and combo boxes associated with clicking on
this checkbox remain highlighted even after I click on the first
checkbox, ChckIBCCP!?
Can you help me?
Here is my code if it helps?
Private Sub ChckIBCCP_Click ()
Dim ctl As Control
* For Each ctl In Me.Controls
* * If ctl.Tag = "Shadow1" And ChckIBCCP = True _
* * And ctl.ControlType = 109 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acTextBox Then
* * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckIBCCP = True _
* * And ctl.ControlType = 111 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acComboBox Then
* * * * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckIBCCP = True _
* * And ctl.ControlType = 106 Then
* * * * ctl.SpecialEffe ct = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffe ct = 1
* * End If
* *Next
End Sub
Private Sub ChckOtherReferr al_Click()
Dim ctl As Control
* For Each ctl In Me.Controls
* * If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
* * And ctl.ControlType = 109 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acTextBox Then
* * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
* * And ctl.ControlType = 111 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acComboBox Then
* * * * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
* * And ctl.ControlType = 106 Then
* * * * ctl.SpecialEffe ct = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffe ct = 1
* * End If
* *Next
End Sub
Thanks!,
John- Hide quoted text -

- Show quoted text -
Thank you! I followed your advice and used an option group!

John
Jul 8 '08 #4
On Jul 1, 8:40*pm, "Carlos Nunes-Ueno" <sulla...@athot maildot.com>
wrote:
As far as I can tell you're doing the same code in both scenarios. *The
only difference is that you're testing a different checkbox each time. *
And since you just checked that box "True" then your code returns would
return the same result each time.

By the way, is there a reason you don't want to use an option group? *
This seems like exactly the kind of scenario that would apply. *Instead
of two procedures you could write one like this:

Private Sub optIBCCP_or_Oth er_AfterUpdate( )
* * Select Case Me.optIBCCP_or_ Other
* * * * Case 1 'IBCCP
* * * * * * 'Dehighlight the "Other" fields
* * * * * * * * 'Highlight the IBCCP fields
* * * * Case 2 'Other
* * * * * * 'Dehighlight the IBCCP fields
* * * * * * * * 'Highlight the "Other" fields
* * End Select
End Sub

Hope that helps,

Carlos

zufie <john.marru...@ illinois.govwro te in news:8ac70202-0a94-45cc-a4ea-
2921b46f2...@x3 5g2000hsb.googl egroups.com:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferr al.
Each checkbox highlights its respective textboxes and combo boxes on
the form.
Many of the highlighted textboxes and combo boxes are the same for
either checkbox selected.
Some of the highlighted textboxes and combo boxes differ depending
upon which checkbox is selected.
I am unable to toggle between the two differing effects caused by
clicking each respective checkbox.
For example when I click on the second checkbox, ChckOtherReferr al,
the highlighted textboxes and combo boxes associated with clicking on
this checkbox remain highlighted even after I click on the first
checkbox, ChckIBCCP!?
Can you help me?
Here is my code if it helps?
Private Sub ChckIBCCP_Click ()
Dim ctl As Control
* For Each ctl In Me.Controls
* * If ctl.Tag = "Shadow1" And ChckIBCCP = True _
* * And ctl.ControlType = 109 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acTextBox Then
* * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckIBCCP = True _
* * And ctl.ControlType = 111 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acComboBox Then
* * * * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckIBCCP = True _
* * And ctl.ControlType = 106 Then
* * * * ctl.SpecialEffe ct = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffe ct = 1
* * End If
* *Next
End Sub
Private Sub ChckOtherReferr al_Click()
Dim ctl As Control
* For Each ctl In Me.Controls
* * If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
* * And ctl.ControlType = 109 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acTextBox Then
* * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
* * And ctl.ControlType = 111 Then
* * * * ctl.BackColor = 16777215
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acComboBox Then
* * * * ctl.BackColor = 65535
* * End If
* * If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
* * And ctl.ControlType = 106 Then
* * * * ctl.SpecialEffe ct = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffe ct = 1
* * End If
* *Next
End Sub
Thanks!,
John- Hide quoted text -

- Show quoted text -
Thank you! I followed your advice!

John
Jul 8 '08 #5

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

Similar topics

2
3958
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 checkboxes are picked up using $_POST and put into session variables. On page two there is another form which is simply a condensed version of the previous one (titles with no descriptions). The checkboxes are named the same on both forms. When...
8
2834
by: Ralph Freshour | last post by:
I have multiple checkbox's created with an array name because I have many on the same web page - their names are like: frm_chk_delete frm_chk_delete frm_chk_delete frm_chk_delete etc. Here is my code line that creates each checkbox (the php variable get
11
4808
by: MLH | last post by:
Why is that? If I choose the tiny check boxes which are hard to hit with a mouse, it works fine. But option buttions, shich can be sized big enough for people with limited sight and dexterity to hit - they don't work at all. Its true. I created 'em with the built-in wizard furnished with Access 97 but they do not work. I put 12 of 'em in the group, labeled the months of the year and giving
4
4343
by: Neil Coleclough | last post by:
I am constructing a database to process product returns for my Company. I have a number of toggle buttons to identify the stage to which each return has been processed. For example, clicking the first button confirms that the goods are now in our building awaiting initial processing. This button then fires off an email to our warehouse staff alerting them to the fact. I want to restrict these buttons to single use, so that once the email...
4
8956
by: deko | last post by:
Basic question about checking the value of Toggle/Check/Combo/OptionGroups.... Checking like this: If Me!chkCheckBox Then ... End If and like this:
1
2326
by: sam | last post by:
Hi All, I have a form with 4 checkboxes and 4 text boxes and one submit button. The form should work such a way when I select a particular checkbox and give a url in text box, the form should get submitted to that url entered in the text box. Is this possible. I know to submit form by metioning the action attribute only. How do this with one button but submitting to different locations on different selection...Can any one help me...
1
4431
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I can't get this button does work properly. The documentation I found in the FM20.CHM files says the button state can be determined from its "Value" property, but the property list shown in VB2005 does not have a "Value" property. How is the button...
0
2000
by: ARC | last post by:
Hello all, In access 2007, it appears you cannot put a toggle button underneath a menu id and have it show a Pressed / Not Pressed status. If you make the toggleButton ID as part of the main ribbon on a form, it will show the pressed status. Does anyone know of any workarounds? If not, what I'm trying to do is have 2 styles of a particular form, and
2
6942
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've come across a way to set the listbox value to only 1 at a time, but need multiple toggle buttons to be on their corresponding listbox item values to be selected. Thanks!
0
8384
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
8302
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
8820
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
7314
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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
4150
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
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
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.