PDA

View Full Version : Solved: ActiveX Check Box to disable other ActiveX Check Boxes



junglej815
01-23-2008, 07:54 AM
Hello all,

Just curious if it is possible to have 1 Activex check box disable other ActiveX checkboxes on a word document. So that When you select a particular check box it makes it so that the other check boxes can't be selected. I tried attaching and example document but it kept saying it was too big.

Any help is not expected but greatly appreciated.

lucas
01-23-2008, 08:33 AM
Hello all,

Just curious if it is possible to have 1 Activex check box disable other ActiveX checkboxes on a word document. So that When you select a particular check box it makes it so that the other check boxes can't be selected. I tried attaching and example document but it kept saying it was too big.

Any help is not expected but greatly appreciated.

zip it up and attach it.

fumei
01-23-2008, 11:15 AM
The answer is - possibly - yes. See below.

Give them all the same GroupName. Now only one of the group may be checked.

You used the word "select".

"So that When you select a particular check box it makes it so that the other check boxes can't be selected."

Using GroupName does NOT do this. GroupName means that if you check ONE, all the others are unchecked. You select any of the others, and if you check THAT ONE...then...all the others become unchecked. Only one check is allowed, but there is NO restriction on which one that is.

Now, if you really actually mean that if you select one, that all the others can not be selected...this is quite a different matter. You would have to disable the others.

junglej815
01-24-2008, 09:02 AM
What's your definition of "select" ?

fumei
01-24-2008, 11:02 AM
No...what is YOUR definition of select? YOU used the word.

I explained that if you used a GroupName among several controls (checkboxes) then only ONE checkbox can be checked. ALL of them can be selected - you can clcik any of them - but only ONE may have a true value (checked). If A, B, and C are grouped:

If A is checked, B and C are made unchecked, regardless of whether they were checked before.

If B is checked, A and C are made unchecked, regardless of whether they were checked before.

If C is checked, A and B are made unchecked, regardless of whether they were checked before.

Any of them can selected, but only one can have a True (checked) value.

junglej815
01-25-2008, 06:24 AM
" No...what is YOUR definition of select? YOU used the word. "

Okay...seriously, what is your deal? Why do you say things in a belittling manner? I was simply asking how you defined "select" because I didn't know if there was a different way of thinking about it as in a VB sense than I suppose an ordinary every sense of the word. I was just trying to undertand what you were saying by trying to think in the way that you might thinking when approaching all this VB content, because you obviously understand and know VB. Why can't you just ask me how I actually define the work politely like how I politely asked you how you define the word and not use caps or " no..."

And it seems as though you are thinking in the manner that everyone thinks about this stuff in the same way that you do. I don't know what you mean by using a GroupName. What do you mean by a GroupName and where in VB is it used or whatever?

My post title:
"ActiveX Check Boxt to DISABLE other ActiveX Check Boxes"
Part of my post:
"So that When you select a particular check box it makes it so that the other check boxes can't be selected."
Part of your response:
"Now, if you really actually mean that if you select one, that all the others can not be selected...this is quite a different matter. You would have to disable the others."

Isn't that part of your response what I said I was looking for originally?

I mean, when I posting my question I was trying to think it through to make sure I was as clear as I could make it. You copped an attitude with me before because I didn't say a command button was an activeX button becasue I didn't know it was an activex thing, so I tried to be concise and put that in. Please just give us people that don't know about this stuff as much as you a break and not put us down because of it.

I said "Any help is not expected but greatly appreciated." I'm not expecting help. Like i said I appreciate the fact that you asnwered me but I don't appreciate the attitude I seem to get. Also like I said, help is not expected, you don't need to answer me if you don't want to. No one is making you.

I just don't get it.

fumei
01-25-2008, 10:13 AM
OK, fair enough.

Select means you can select it. It means you can click it - your checkbox - and check/uncheck it. It functions.

Here is your post:

"Just curious if it is possible to have 1 Activex check box disable other ActiveX checkboxes on a word document. So that When you select a particular check box it makes it so that the other check boxes can't be selected. "

My bolding.

I explained that you can set things up so if you check one checkbox, it makes the other checkboxes unchecked. The others are NOT "disabled". You can check them if you want. If you do, the same thing applies.

I explained you set this up by using GroupName.

"I don't know what you mean by using a GroupName. What do you mean by a GroupName and where in VB is it used or whatever?"

You never even asked HOW to use GroupName. If you had asked, I would have simply told you.

I asked if this was what you wanted, or do you really want any others truly disabled. I stated:

"Now, if you really actually mean that if you select one, that all the others can not be selected...this is quite a different matter. You would have to disable the others."

All you need to do is clearly state what it is you want, and I have tried to explain the differences. Here it is again.

Disabled:

checking a checkbox will not allow any other checkbox to be selected and checked.

GroupName:

checking any checkbox makes all other checkboxes unchecked. They can still be selected and checked, but if they are, then...all the others become unchecked.

Which do you want?

GroupName is a property. Right-click a control (a checkbox in this case), and select Properties. Give it a name for GroupName. Give the same name, as a GroupName, for all the controls you wish to group. Once grouped, then only ONE of the group may BE checked, but ALL of the group can be selected and checked.

junglej815
01-25-2008, 10:41 AM
Ok...I guess even though I was trying to be as clear as I could I guess it wasn't totally clear...I guess by "select" I meant "click" but anyways...fresh start..fair enough?

I have a form ( I would zip it up and load it on here as Lucas suggested, but I don't even fully know how to do that and don't even know if the computer I'm on has winzip on it ) that has 14 ActiveX Check Boxes on it.

4 of these check boxes represent: AM PM AM PM

The other 10 check boxes represent items of equipment that someone can check the checkbox to show that they want to use that item of equipment.

I had an idea of having another checkbox on the page that would represent: none. If the customer does not need any equipment then they can click on that check box to place a checkmark in that box. When they click/check this box it makes it so that all the other equipment check boxes become disabled or dimmed out or whatever you would want to call it where you are not able to click on and place a checkmark inside the boxes.

I still need it so that the customer can be able to place a checkmark in the boxes for each item or as many items as they need.

I suppose I could just have that one box representing none and just leave it as that, but just wondering if this was possible.

fumei
01-25-2008, 11:03 AM
Look, I am sorry I get crabby. All I am/was trying to do is get people to think in ways that are appropriate to get what they want. the first thing is clearly stating, very very explicitly what that is. Once you wrote:

"I had an idea of having another checkbox on the page that would represent: none. If the customer does not need any equipment then they can click on that check box to place a checkmark in that box. When they click/check this box it makes it so that all the other equipment check boxes become disabled or dimmed out or whatever you would want to call it where you are not able to click on and place a checkmark inside the boxes."

I had something to really work with. So...here is a demo that does exactly that. It took me less than four minutes to make this document, now that I know what it was EXACTLY you were asking for.

If you check the "No equipment" checkbox, the other three - heck I am not going to make 10 just for a demo - are:

1. disabled. You can NOT select them
2. if they HAD been checked, they are unchecked.

#2 is also - like the other stuff - simply a matter of logic. say one had been checked...then afterwards No Equipment checked. Does it logically make sense to leave that one checked?

Test it out. Check one or two checkbox, then the No Equipment checkbox. Now uncheck No Equipment.

fumei
01-25-2008, 12:30 PM
Here is a further demo that shows the difference being being to select a control, and NOT being able to select a control.

The first table has three OptionButtons, grouped. Only one may be TRUE, but all of them can be selected and made TRUE.

The second table has four Checkboxes. You can check any combination of the first three, but if you check the fourth (No Equipment), the first three are cleared - unchecked - and then disabled. When they are disabled, they can NOT be selected.

Hopefully this may help with understanding some terminology, and how ActiveX controls function.

junglej815
01-25-2008, 01:23 PM
Thanks a lot for looking into this, I'll have to check it out. Sorry as well for not being totally clear and everything. Like I said I really do appreciate the help. It's tough to try and fully explain something in just words online, casue its obviously a lot easier to express what someone is looking for in person.

junglej815
01-27-2008, 09:24 AM
Thanks a lot! That's exactly what I was looking for. I have some activex text boxes on the document as well. I applied the same code to those as well to disable them and it worked but it comes up with the word "false" in the textbox. Is there a way for it to be blank in the box or becaue you're using the "false" code there's nothing you can do?

junglej815
01-27-2008, 12:10 PM
I played around and got it to be disabled and have zeros put in.

fumei
01-28-2008, 01:44 AM
Ummm, " I applied the same code to those as well to disable them and it worked but it comes up with the word "false" in the textbox."

The code uses "False", as it was for OptionButtons, or Checkboxes....NOT a textbox.

Checkboxes and OptionButtons are true (checked) or False (unchecked).

Textboxes are text.

If you want the textboxes empty, put in an empty string - ""

"I have some activex text boxes on the document as well. I applied the same code to those as well to disable them"

Then you should have mentioned them, the textboxes that is. As you never mentioned them, I did nothing to deal with textboxes. I am NOT being critical, but this is an example of how crucial it is to speak plainly, clearly, and precisely, telling us exactly the situation, and what you want. If you had mentioned textboxes - and what you want to do with them - it would have taken me seconds to add that functionality to the demos.

junglej815
01-28-2008, 05:39 AM
It's no biggie....When I posting my original question I was only thinking about the checkboxes, I wasn't even thinking about the text boxes. When I did the code for the checkboxes it worked and I was like " oh crap, I forgot about the textboxes." I just set it so the value in the textboxes are zero and its alright. Sorry.

fumei
01-28-2008, 06:10 AM
"I just set it so the value in the textboxes are zero and its alright. Sorry."

No need to really apologize, but again, do not made it 0. Why do that? To me it is confusing to the users, plus they have to select it to change it. It holds text, a string. If you want it blank...make it blank. Use an empty string - "".

junglej815
01-28-2008, 06:56 AM
Well the way its set up is:

I have a checkbox for "flipcharts" then im using a text for for the user to enter how many of them they need.

So if somone needs flipcharts they click on and check flipchart and then they can enter a quantity in the text box.

So it kind of works out where if they click on " no equipment needed" it inserts a zero because they don't need any.

I do have to say that i dont' really know what the empty string you're talking about really is.

jasoncw
01-28-2008, 10:54 AM
. . .I do have to say that i dont' really know what the empty string you're talking about really is.
Instead of using TextBox1.Value = 0, use TextBox1.Text = "".

HTH

Jason

fumei
01-28-2008, 01:31 PM
A textbox contains text. Text is a string. Strings values are usually between quotes. "This is a string."

If you want a string to be nothing, then you use nothing between the quotes. Thus: ""

VBA is smart enough to convert given values going into textboxes that are not, technically strings - like 0, or False - and make them strings.

While in most cases .Value and .Text of a textbox are interchangeable, to be very careful and explicit, it is better to use .Text when you mean text. Although, for a TextBox, any value you assign to the Text property is also assigned to the Value property. They are two separate properties, but hold the same values.

TextBox1.Value = ""
TextBox1.Text = ""

have the exact same result.

On the other hand:CheckBox1.Value = ""
MsgBox CheckBox1.Valuethe messagebox instruction will error out as an Invalid use of Null.

What the "" in a Checkbox does is the equivalent of -1

Checkbox1.Value = ""

is acceptable as an input. The checkbox is checked, but now greyed out, and the Value shows (in properties) as blank...Null. It is NOT acceptable to retrieve a Null and pass it to a control that is string demanding. Like a messagebox. A message demands a string, and Null is NOT a string...even though you can give it "" - a string, but it is an empty, not a Null string.

Checkbox1.Value = 1
Checkbox1.Value = True

are equivalent. The checkbox is checked, but NOT greyed out.

Checkbox1.Value = 0
Checkbox1.Value = False

are equivalent. The checkbox is unchecked.

Note that if you do:Checkbox1.Value = 1
Msgbox Checkbox1.Valueyou get "True"....a string.

junglej815
01-28-2008, 02:43 PM
Ahhhhhhhh.....makes sense, I get it now. Thanks for explaining it guys.

ghines
03-19-2008, 01:25 PM
Will certainly use this for something I am working on as well. May be posting additional comments after reviewing the attached file.

Thanks!