only allowing one checkbox to be checked on template 
Author Message
 only allowing one checkbox to be checked on template

What code can I use to ensure that one and only one of the
checkboxes in a certain section of my template is
checked?  One must be checked and you cannot check more
than one.  Thanks for your help.


Mon, 21 Feb 2005 21:19:40 GMT  
 only allowing one checkbox to be checked on template
Hi Chris,

Have a look at the article "Making groups of Check Box Form Fields mutually
exclusive (so that they behave like radio buttons)" at
http://www.mvps.org/word/FAQs/TblsFldsFms/ExclusiveFmFldChbxs.htm

HTH


Quote:
> What code can I use to ensure that one and only one of the
> checkboxes in a certain section of my template is
> checked?  One must be checked and you cannot check more
> than one.  Thanks for your help.



Mon, 21 Feb 2005 22:20:47 GMT  
 only allowing one checkbox to be checked on template
Thanks, Dave, for the quick and helpful response.  
Unfortjnately for me all of my checkboxes are in a table.  
Is there any other way to do this than the way you sent me
(which will not work if the checkboxes are in a table
since it requires the use of Frames)?

Quote:
>-----Original Message-----
>Hi Chris,

>Have a look at the article "Making groups of Check Box

Form Fields mutually
Quote:
>exclusive (so that they behave like radio buttons)" at
>http://www.mvps.org/word/FAQs/TblsFldsFms/ExclusiveFmFldCh
bxs.htm

>HTH



>> What code can I use to ensure that one and only one of
the
>> checkboxes in a certain section of my template is
>> checked?  One must be checked and you cannot check more
>> than one.  Thanks for your help.

>.



Mon, 21 Feb 2005 23:02:41 GMT  
 only allowing one checkbox to be checked on template
Hi Chris,

Dim oField As FormField

For Each oField In Selection.Tables(1).Range.FormFields
    oField.CheckBox.Value = False
Next oField

Selection.FormFields(1).CheckBox.Value = True

HTH


Quote:
> Hi Chris,

> Have a look at the article "Making groups of Check Box Form Fields
mutually
> exclusive (so that they behave like radio buttons)" at
> http://www.mvps.org/word/FAQs/TblsFldsFms/ExclusiveFmFldChbxs.htm

> HTH



> > What code can I use to ensure that one and only one of the
> > checkboxes in a certain section of my template is
> > checked?  One must be checked and you cannot check more
> > than one.  Thanks for your help.



Mon, 21 Feb 2005 23:28:40 GMT  
 only allowing one checkbox to be checked on template
Thanks, Dave.  This works like a charm once someone
actually clicks on one of te checkboxes.  But I also need
to make sure that when the user goes to Save or Send the
document that at least one of the checkboxes in that table
in the form is checked.  What code do I need to use in the
DocumentBeforeSave or DocumentBeforeSend procedure in
order to ensure that one of the checkboxes is checked?
Quote:
>-----Original Message-----
>Hi Chris,

>Dim oField As FormField

>For Each oField In Selection.Tables(1).Range.FormFields
>    oField.CheckBox.Value = False
>Next oField

>Selection.FormFields(1).CheckBox.Value = True

>HTH



>> Hi Chris,

>> Have a look at the article "Making groups of Check Box
Form Fields
>mutually
>> exclusive (so that they behave like radio buttons)" at

http://www.mvps.org/word/FAQs/TblsFldsFms/ExclusiveFmFldChb
xs.htm

- Show quoted text -

Quote:

>> HTH



>> > What code can I use to ensure that one and only one
of the
>> > checkboxes in a certain section of my template is
>> > checked?  One must be checked and you cannot check
more
>> > than one.  Thanks for your help.

>.



Tue, 22 Feb 2005 02:52:15 GMT  
 only allowing one checkbox to be checked on template
Hi Chris,

Can you use something like the following:

Dim oField As FormField
Dim bChecked As Boolean
For Each oField In Selection.Tables(1).Range.FormFields
    If oField.CheckBox.Value Then
        bChecked = True
    End If
Next oField

If bChecked Then
    ' your save procedures
Else
    MsgBox "You must select at least one of the checkboxes.", vbCritical
End If

I don't really use the document events. I prefer to intercept Word's
commands (for more information, see "Intercepting events like Save and
Print" at http://www.mvps.org/word/FAQs/MacrosVBA/InterceptSavePrint.htm

HTH


Quote:
> Thanks, Dave.  This works like a charm once someone
> actually clicks on one of te checkboxes.  But I also need
> to make sure that when the user goes to Save or Send the
> document that at least one of the checkboxes in that table
> in the form is checked.  What code do I need to use in the
> DocumentBeforeSave or DocumentBeforeSend procedure in
> order to ensure that one of the checkboxes is checked?
> >-----Original Message-----
> >Hi Chris,

> >Dim oField As FormField

> >For Each oField In Selection.Tables(1).Range.FormFields
> >    oField.CheckBox.Value = False
> >Next oField

> >Selection.FormFields(1).CheckBox.Value = True

> >HTH



> >> Hi Chris,

> >> Have a look at the article "Making groups of Check Box
> Form Fields
> >mutually
> >> exclusive (so that they behave like radio buttons)" at

> http://www.mvps.org/word/FAQs/TblsFldsFms/ExclusiveFmFldChb
> xs.htm

> >> HTH



> >> > What code can I use to ensure that one and only one
> of the
> >> > checkboxes in a certain section of my template is
> >> > checked?  One must be checked and you cannot check
> more
> >> > than one.  Thanks for your help.

> >.



Tue, 22 Feb 2005 03:09:51 GMT  
 only allowing one checkbox to be checked on template
Sorry, Dave but I am getting an error when trying to use
the code below.  At the line "If oField.CheckBox.Value
Then" it tells me there is a bad parameter.  So I added "=
True" thinking that would resolve it (i.e. the line now
reads "If oField.CheckBox.Value = True Then" but I still
get the error message 'Run-time error '4120'.  Bad
parameter' on that line.  Any suggestions?

Quote:
>-----Original Message-----
>Hi Chris,

>Can you use something like the following:

>Dim oField As FormField
>Dim bChecked As Boolean
>For Each oField In Selection.Tables(1).Range.FormFields
>    If oField.CheckBox.Value Then
>        bChecked = True
>    End If
>Next oField

>If bChecked Then
>    ' your save procedures
>Else
>    MsgBox "You must select at least one of the

checkboxes.", vbCritical
Quote:
>End If

>I don't really use the document events. I prefer to
intercept Word's
>commands (for more information, see "Intercepting events
like Save and
>Print" at

http://www.mvps.org/word/FAQs/MacrosVBA/InterceptSavePrint.
htm

- Show quoted text -

Quote:

>HTH



>> Thanks, Dave.  This works like a charm once someone
>> actually clicks on one of te checkboxes.  But I also
need
>> to make sure that when the user goes to Save or Send the
>> document that at least one of the checkboxes in that
table
>> in the form is checked.  What code do I need to use in
the
>> DocumentBeforeSave or DocumentBeforeSend procedure in
>> order to ensure that one of the checkboxes is checked?
>> >-----Original Message-----
>> >Hi Chris,

>> >Dim oField As FormField

>> >For Each oField In Selection.Tables(1).Range.FormFields
>> >    oField.CheckBox.Value = False
>> >Next oField

>> >Selection.FormFields(1).CheckBox.Value = True

>> >HTH



>> >> Hi Chris,

>> >> Have a look at the article "Making groups of Check
Box
>> Form Fields
>> >mutually
>> >> exclusive (so that they behave like radio buttons)"
at

http://www.mvps.org/word/FAQs/TblsFldsFms/ExclusiveFmFldChb

- Show quoted text -

Quote:
>> xs.htm

>> >> HTH



>> >> > What code can I use to ensure that one and only one
>> of the
>> >> > checkboxes in a certain section of my template is
>> >> > checked?  One must be checked and you cannot check
>> more
>> >> > than one.  Thanks for your help.

>> >.

>.



Tue, 22 Feb 2005 23:00:58 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Allowing only one user to use the template at a time --

2. Dynamically Added Datagrid Template Column - Checkbox.Checked state in Column Header

3. Refering to Functions and Subs held in one global template from another global template

4. Two similar templates--one works one doesn't

5. Colling a function from one template to an other one

6. Am I allowed to copy texts and DLLs?

7. List cotrols that allow checkboxes.

8. Listbox, Style = checkbox, but allow mulit selection

9. I am looking for a product test (how to write) template

10. True DBGrid Pro 6.0 + Checkbox (Bin am verzweifeln!)

11. Checkbox on FAX Template

12. Calculate checkbox value on a template

 

 
Powered by phpBB® Forum Software