Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default Validating checkbox values in MS Word

I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.

What I want to do is not allow the user to check both checkboxes for
one question.

Can anyone help with what the code would look like?

Thanks so much!

  #2   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman
 
Posts: n/a
Default Validating checkbox values in MS Word

See http://www.word.mvps.org/FAQs/TblsFl...FmFldChbxs.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 07:42:50 -0700, wrote:

I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.

What I want to do is not allow the user to check both checkboxes for
one question.

Can anyone help with what the code would look like?

Thanks so much!

  #3   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default Validating checkbox values in MS Word

Jay:

Thanks so much for the reference.

Is there any way to do this in code? The reason being is that I have
my form set up in a table and have some other code hiding and unhiding
text in table cells based upon a selection the user makes in the form.
This text that is hiding and unhiding also has Yes/No fields associated
with it, so you see why I need to leave it in a table. If I take
everything out of tables then I need to rewrite the code I currently
have for the other form operation.

Debbie

Jay Freedman wrote:
See http://www.word.mvps.org/FAQs/TblsFl...FmFldChbxs.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 07:42:50 -0700, wrote:

I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.

What I want to do is not allow the user to check both checkboxes for
one question.

Can anyone help with what the code would look like?

Thanks so much!


  #4   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman
 
Posts: n/a
Default Validating checkbox values in MS Word

Off the top of my head, it *should* be possible to handle the fields
in tables. I just don't have time right now to test the code.

First, I'm making the assumption that the Yes and No check boxes for
the same question are always in the same row of a table.

The idea is this: At the beginning of the MakeCheckBoxesExclusive
macro, use

RowNum = Selection.Information(wdEndOfRangeRowNumber)

to find out which table row contains the check box that was just
clicked. Then replace the line

For Each oField In Selection.Frames(1).Range.FormFields

in the code of the article with the line

For Each oField In Selection.Tables(1).Row(RowNum).Range.FormFields

This should uncheck both boxes in that one row, and then the macro
checks the box that was just clicked. Although it may seem confusing,
the expression Selection.Tables(1) refers to the first (and only)
table in the Selection, not to the first table in the document.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 12:26:11 -0700, wrote:

Jay:

Thanks so much for the reference.

Is there any way to do this in code? The reason being is that I have
my form set up in a table and have some other code hiding and unhiding
text in table cells based upon a selection the user makes in the form.
This text that is hiding and unhiding also has Yes/No fields associated
with it, so you see why I need to leave it in a table. If I take
everything out of tables then I need to rewrite the code I currently
have for the other form operation.

Debbie

Jay Freedman wrote:
See
http://www.word.mvps.org/FAQs/TblsFl...FmFldChbxs.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 07:42:50 -0700, wrote:

I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.

What I want to do is not allow the user to check both checkboxes for
one question.

Can anyone help with what the code would look like?

Thanks so much!

  #5   Report Post  
Posted to microsoft.public.word.tables
 
Posts: n/a
Default Validating checkbox values in MS Word

Jay:
That works great! Thank you.

The only problem with it is that if you tab or use your arrow keys it
will uncheck the Yes checkbox and check the No checkbox and I know that
in the link you provided earlier they state that this is one of the
downfalls, but is there anything I an put in code to stop this from
happening?

Thanks again!
Debbie

Jay Freedman wrote:
Off the top of my head, it *should* be possible to handle the fields
in tables. I just don't have time right now to test the code.

First, I'm making the assumption that the Yes and No check boxes for
the same question are always in the same row of a table.

The idea is this: At the beginning of the MakeCheckBoxesExclusive
macro, use

RowNum = Selection.Information(wdEndOfRangeRowNumber)

to find out which table row contains the check box that was just
clicked. Then replace the line

For Each oField In Selection.Frames(1).Range.FormFields

in the code of the article with the line

For Each oField In Selection.Tables(1).Row(RowNum).Range.FormFields

This should uncheck both boxes in that one row, and then the macro
checks the box that was just clicked. Although it may seem confusing,
the expression Selection.Tables(1) refers to the first (and only)
table in the Selection, not to the first table in the document.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 12:26:11 -0700, wrote:

Jay:

Thanks so much for the reference.

Is there any way to do this in code? The reason being is that I have
my form set up in a table and have some other code hiding and unhiding
text in table cells based upon a selection the user makes in the form.
This text that is hiding and unhiding also has Yes/No fields associated
with it, so you see why I need to leave it in a table. If I take
everything out of tables then I need to rewrite the code I currently
have for the other form operation.

Debbie

Jay Freedman wrote:
See
http://www.word.mvps.org/FAQs/TblsFl...FmFldChbxs.htm.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On 7 Jun 2006 07:42:50 -0700, wrote:

I have a form where I have multiple Yes/No checkboxes next to
questions. The Yes/No checkboxes reside in a table and each checkbox
is in its own table cell.

What I want to do is not allow the user to check both checkboxes for
one question.

Can anyone help with what the code would look like?

Thanks so much!


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why dont MS just f**king re-write Word from scratch? Its dogsh*t Word Hater Microsoft Word Help 33 May 5th 23 02:52 PM
How do I "reveal codes" in Word the way I could in Word Perfect? crystal Microsoft Word Help 3 May 11th 06 02:10 AM
WP merge file to Word sstires Tables 4 February 14th 06 06:26 PM
How can Word display full path of a file in the title bar? SAsif Microsoft Word Help 1 January 26th 06 04:32 PM
Envelope Address GR New Users 5 April 24th 05 09:48 PM


All times are GMT +1. The time now is 05:26 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"