473,832 Members | 2,114 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 7115
"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
4637
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, I like to write my page so that when the user
0
2133
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 Preference", I'd like to uncheck
2
1900
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
6069
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
2449
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, instead of being one by one like is now with the Select column. Another question, is it possible to...
2
2260
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
10435
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
3849
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 2fold. I have the following code that constructs the checkbox response.write "<input type=checkbox...
3
1957
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. Please help me to point out the error. <html> <head> <style type="text/css"> body...
0
9795
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
9642
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
10780
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...
1
10540
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9319
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
7753
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
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4421
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
3
3077
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.