473,585 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TypeOf/OptionGroup/CheckBox question

Using A2003. I've got an option group that has a number of check
boxes. I have coding to clear the option group if the user wishes to
cancel their choice. This coding also clears the rest of the controls
on the form. Snippet of the coding:

<..snipped..>
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Value = False
<..snipped..>
ElseIf TypeOf oCtrl Is OptionGroup Then
oCtrl.Value = 0

I get the error message "You can't assign a value to this object" when
this code hits the first check box in the option group. I assume it's
because the check box is part of the option group.

I tried adding an "..oCtrl is OptionButton" but continued to get the
error.

I take it that the check boxes within the option group have to be
ignored. Is there a way to test the check box and if it belongs to the
option group, then ignore it? Or do I have to refer them by name to
ignore? Something like this:

ElseIf TypeOf oCtrl Is CheckBox Then
<if name of control is CheckXX or CheckYY or ... then ignore
this check box>

Thanks for any help or advice.

Sep 13 '06 #1
4 7100
"EManning" <ma**********@h otmail.comwrote in message
<11************ **********@d34g 2000cwd.googleg roups.com>:
Using A2003. I've got an option group that has a number of check
boxes. I have coding to clear the option group if the user wishes to
cancel their choice. This coding also clears the rest of the
controls on the form. Snippet of the coding:

<..snipped..>
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Value = False
<..snipped..>
ElseIf TypeOf oCtrl Is OptionGroup Then
oCtrl.Value = 0

I get the error message "You can't assign a value to this object"
when this code hits the first check box in the option group. I
assume it's because the check box is part of the option group.

I tried adding an "..oCtrl is OptionButton" but continued to get the
error.

I take it that the check boxes within the option group have to be
ignored. Is there a way to test the check box and if it belongs to
the option group, then ignore it? Or do I have to refer them by
name to ignore? Something like this:

ElseIf TypeOf oCtrl Is CheckBox Then
<if name of control is CheckXX or CheckYY or ... then
ignore this check box>

Thanks for any help or advice.
I think there might be more than one way of dealing with such. Here's
one idea - assign the parent of the control to an object, and check
whether it is an option group. Some air code

dim x as object
ElseIf TypeOf oCtrl Is CheckBox Then
set x = oCtrl.Parent
if not typeof x is OptionGroup then
oCtrl.Value = False
end if
set x = nothing

or check the name property of the parent control against the form name
- though, I think maybe objects on the form might have the same name
as the form?

ElseIf TypeOf oCtrl Is CheckBox Then
if oCtrl.Parent.Na me = me.name then
oCtrl.Value = False
end if

--
Roy-Vidar
Sep 13 '06 #2
Test the parent controltype e.g.

ElseIf TypeOf oCtrl Is CheckBox Then
If Not TypeOf oCtrl.Parent Is OptionGroup Then
oCtrl.Value = False
End If
ElseIf TypeOf oCtrl Is OptionGroup Then
oCtrl.Value = 0
--

Terry Kreft
"EManning" <ma**********@h otmail.comwrote in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
Using A2003. I've got an option group that has a number of check
boxes. I have coding to clear the option group if the user wishes to
cancel their choice. This coding also clears the rest of the controls
on the form. Snippet of the coding:

<..snipped..>
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Value = False
<..snipped..>
ElseIf TypeOf oCtrl Is OptionGroup Then
oCtrl.Value = 0

I get the error message "You can't assign a value to this object" when
this code hits the first check box in the option group. I assume it's
because the check box is part of the option group.

I tried adding an "..oCtrl is OptionButton" but continued to get the
error.

I take it that the check boxes within the option group have to be
ignored. Is there a way to test the check box and if it belongs to the
option group, then ignore it? Or do I have to refer them by name to
ignore? Something like this:

ElseIf TypeOf oCtrl Is CheckBox Then
<if name of control is CheckXX or CheckYY or ... then ignore
this check box>

Thanks for any help or advice.

Sep 13 '06 #3
Hey thanks. Your idea of "set x = oCtrl.Parent... " worked just fine.
RoyVidar wrote:
"EManning" <ma**********@h otmail.comwrote in message
<11************ **********@d34g 2000cwd.googleg roups.com>:
Using A2003. I've got an option group that has a number of check
boxes. I have coding to clear the option group if the user wishes to
cancel their choice. This coding also clears the rest of the
controls on the form. Snippet of the coding:

<..snipped..>
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Value = False
<..snipped..>
ElseIf TypeOf oCtrl Is OptionGroup Then
oCtrl.Value = 0

I get the error message "You can't assign a value to this object"
when this code hits the first check box in the option group. I
assume it's because the check box is part of the option group.

I tried adding an "..oCtrl is OptionButton" but continued to get the
error.

I take it that the check boxes within the option group have to be
ignored. Is there a way to test the check box and if it belongs to
the option group, then ignore it? Or do I have to refer them by
name to ignore? Something like this:

ElseIf TypeOf oCtrl Is CheckBox Then
<if name of control is CheckXX or CheckYY or ... then
ignore this check box>

Thanks for any help or advice.

I think there might be more than one way of dealing with such. Here's
one idea - assign the parent of the control to an object, and check
whether it is an option group. Some air code

dim x as object
ElseIf TypeOf oCtrl Is CheckBox Then
set x = oCtrl.Parent
if not typeof x is OptionGroup then
oCtrl.Value = False
end if
set x = nothing

or check the name property of the parent control against the form name
- though, I think maybe objects on the form might have the same name
as the form?

ElseIf TypeOf oCtrl Is CheckBox Then
if oCtrl.Parent.Na me = me.name then
oCtrl.Value = False
end if

--
Roy-Vidar
Sep 13 '06 #4
EManning wrote:
Using A2003. I've got an option group that has a number of check
boxes. I have coding to clear the option group if the user wishes to
cancel their choice. This coding also clears the rest of the controls
on the form. Snippet of the coding:

<..snipped..>
ElseIf TypeOf oCtrl Is CheckBox Then
oCtrl.Value = False
<..snipped..>
ElseIf TypeOf oCtrl Is OptionGroup Then
oCtrl.Value = 0

I get the error message "You can't assign a value to this object" when
this code hits the first check box in the option group. I assume it's
because the check box is part of the option group.

I tried adding an "..oCtrl is OptionButton" but continued to get the
error.

I take it that the check boxes within the option group have to be
ignored. Is there a way to test the check box and if it belongs to the
option group, then ignore it? Or do I have to refer them by name to
ignore? Something like this:

ElseIf TypeOf oCtrl Is CheckBox Then
<if name of control is CheckXX or CheckYY or ... then ignore
this check box>

Thanks for any help or advice.
In response to Terry's post, I would check for a Frame/Option group
prior to a checkbox. In fact, I wouldn't bother checking for checkboxes
unless you have ones not contained within an option group. In an option
group, the radio buttons/checkboxes are irrelevent...yo u get the value
of the option group and let Access determine if its checked or not.
Sep 13 '06 #5

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

Similar topics

4
4626
by: Jay | last post by:
Hi everybody ! I am currently writing a webpage that displays a list of records ( each record has a checkbox associated with it) to allow users to select any record they want to delete (much like in "hotmail" or "yahoo" e-mail where u can select particular message to delete) ? Anybody have any idea how to do it ? And one more question,...
0
2121
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to construct a checkbox array in a survey form where one of the choices is "No Preference" which is checked by default. If the victim chooses other than "No...
2
1896
by: Fred | last post by:
Hi, I defined a form consisting of checkboxes like: <form> <input type="checkbox" name=ck id=ck onclick="check(this.form)" <input type="checkbox" name=ck id=ck onclick="check(this.form)" ..... <input type="checkbox" name=ck id=ck onclick="check(this.form)" </form>
13
6051
by: Jason Huang | last post by:
Hi, Would someone give me an example for the typeof() function? What's that for? Thanks for help. Jason
10
2414
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox control in a datagrid? Now I have a Select column but the problem is that the user needs to select more than one record and send them all to print,...
2
2255
by: Gabriele Bertolucci | last post by:
In VBA I would like to test if an OptionButton is chiled of an OptionGroup. I wrote this test OptionButton.Parent.ControlType = acOptionGroup It's all OK if this test is executed on an OptionButton which IS CHILD of an OptionGroup, but if the OptionButton is a standalone control I get the following error:
4
10406
by: Matrixreloadedth | last post by:
How to change disable color of Checkbox??? I have a checkbox with forecolor in red but when i disable by set Enable properties to false forecolor is changed to gray color but i don't want it. how to make disable color as the same before set enable = false Anyone can help me?????
34
3774
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...
3
1945
by: chiku1523 | last post by:
Hi, Please find the following code. In function setAnswers, I am looping with each question. I have inner loop, which is looping for each answers of the questions. If any of the answer for question 1 and question2 is selected this code is working fine. But if None of answer of either question selected, it is not iterating through outer loop....
0
7908
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...
0
8199
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. ...
0
8336
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...
1
7950
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6606
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...
1
5710
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...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
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...

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.