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

Toggle between two checkboxes on a form

I have two checkboxes on a form, ChckIBCCP and ChckOtherReferral.

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, ChckOtherReferral,
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.SpecialEffect = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffect = 1
End If
Next
End Sub
Private Sub ChckOtherReferral_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If ctl.Tag = "Shadow1" And ChckOtherReferral = 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 ChckOtherReferral = 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 ChckOtherReferral = True _
And ctl.ControlType = 106 Then
ctl.SpecialEffect = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffect = 1
End If
Next
End Sub
Thanks!,

John
Jul 1 '08 #1
4 3337
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.com
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_Other_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.govwrote in news:8ac70202-0a94-45cc-a4ea-
29**********@x35g2000hsb.googlegroups.com:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferral.

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, ChckOtherReferral,
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.SpecialEffect = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffect = 1
End If
Next
End Sub
Private Sub ChckOtherReferral_Click()
Dim ctl As Control

For Each ctl In Me.Controls
If ctl.Tag = "Shadow1" And ChckOtherReferral = 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 ChckOtherReferral = 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 ChckOtherReferral = True _
And ctl.ControlType = 106 Then
ctl.SpecialEffect = 4
ElseIf ctl.Tag = "" And ctl.ControlType _
= acCheckBox Then
ctl.SpecialEffect = 1
End If
Next
End Sub
Thanks!,

John
Jul 2 '08 #3
On Jul 1, 8:40*pm, "Carlos Nunes-Ueno" <sulla...@athotmaildot.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_Other_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.govwrote in news:8ac70202-0a94-45cc-a4ea-
2921b46f2...@x35g2000hsb.googlegroups.com:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferral.
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, ChckOtherReferral,
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.SpecialEffect = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffect = 1
* * End If
* *Next
End Sub
Private Sub ChckOtherReferral_Click()
Dim ctl As Control
* For Each ctl In Me.Controls
* * If ctl.Tag = "Shadow1" And ChckOtherReferral = 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 ChckOtherReferral = 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 ChckOtherReferral = True _
* * And ctl.ControlType = 106 Then
* * * * ctl.SpecialEffect = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffect = 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...@athotmaildot.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_Other_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.govwrote in news:8ac70202-0a94-45cc-a4ea-
2921b46f2...@x35g2000hsb.googlegroups.com:
I have two checkboxes on a form, ChckIBCCP and ChckOtherReferral.
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, ChckOtherReferral,
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.SpecialEffect = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffect = 1
* * End If
* *Next
End Sub
Private Sub ChckOtherReferral_Click()
Dim ctl As Control
* For Each ctl In Me.Controls
* * If ctl.Tag = "Shadow1" And ChckOtherReferral = 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 ChckOtherReferral = 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 ChckOtherReferral = True _
* * And ctl.ControlType = 106 Then
* * * * ctl.SpecialEffect = 4
* * ElseIf ctl.Tag = "" And ctl.ControlType _
* * = acCheckBox Then
* * * * ctl.SpecialEffect = 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
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...
8
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...
11
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...
4
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...
4
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
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...
1
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...
0
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...
2
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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,...
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
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...
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.