A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Hide a row in a table based upon a previous selection



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2006, 02:07 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Hide a row in a table based upon a previous selection

I have a Word 2003 form. There are multiple tables on the form. What
I want to do is to hide a selection of text in table #3, Row 27 if a
selection in Table 1, row 1, field10 is greater than 5 characters and
show another row of text.

I've looked through the postings and have not found anything quite like
this.

Can anyone help me out with some code?

Thanks so much!

  #2  
Old June 5th, 2006, 06:31 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Hide a row in a table based upon a previous selection

You could run a macro on exit from Field 10 and gets the .Result of that
formfield and depending upon it's length, set the font in Row 27 of table 3
as hidden. I am not sure where the other row of text enters into this.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
ups.com...
I have a Word 2003 form. There are multiple tables on the form. What
I want to do is to hide a selection of text in table #3, Row 27 if a
selection in Table 1, row 1, field10 is greater than 5 characters and
show another row of text.

I've looked through the postings and have not found anything quite like
this.

Can anyone help me out with some code?

Thanks so much!



  #4  
Old June 5th, 2006, 09:37 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Hide a row in a table based upon a previous selection

You will have to include

ActiveDocument.Unprotect

and then later

ActiveDocument.Protect wdAllowOnlyFormFields, NoReset

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
oups.com...

wrote:
I have a Word 2003 form. There are multiple tables on the form. What
I want to do is to hide a selection of text in table #3, Row 27 if a
selection in Table 1, row 1, field10 is greater than 5 characters and
show another row of text.

I've looked through the postings and have not found anything quite like
this.

Can anyone help me out with some code?

Thanks so much!


Oh and by the way, the form is protected. As I'm working through
trying to create this code it keeps giving me an error saying that the
section I have in the code is protected.

I really need some help on this.....anybody have any suggestions



  #5  
Old June 6th, 2006, 02:07 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Hide a row in a table based upon a previous selection

Doug:

Ok here is my code so far. What I'm trying to do is: if the zip code
form field is more than 5 digits (which is so for Canada) then hide
rows 22, 23 and 29 but if it is a USA zip code 5 digits, then show rows
22,23 and 29 and hide row 21.

Can you help me out as my code isn't working. Thanks a bunch!

Public Sub CanadaZipCode()

If ActiveDocument.FormFields("zipcode").Result = 5 Then
ActiveDocument.Unprotect
ActiveDocument.Tables(3).Rows(21).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(22).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(23).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(29).Range.Font.Hidde n = False
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset
Else
If ActiveDocument.FormFields("zipcode").Result 5 Then
ActiveDocument.Unprotect
ActiveDocument.Tables(3).Rows(21).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(22).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(23).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(29).Range.Font.Hidde n = True
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset



End If
End If

End Sub


Doug Robbins - Word MVP wrote:
You will have to include

ActiveDocument.Unprotect

and then later

ActiveDocument.Protect wdAllowOnlyFormFields, NoReset

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
oups.com...

wrote:
I have a Word 2003 form. There are multiple tables on the form. What
I want to do is to hide a selection of text in table #3, Row 27 if a
selection in Table 1, row 1, field10 is greater than 5 characters and
show another row of text.

I've looked through the postings and have not found anything quite like
this.

Can anyone help me out with some code?

Thanks so much!


Oh and by the way, the form is protected. As I'm working through
trying to create this code it keeps giving me an error saying that the
section I have in the code is protected.

I really need some help on this.....anybody have any suggestions


  #6  
Old June 6th, 2006, 08:08 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Hide a row in a table based upon a previous selection

ActiveDocument.FormFields("zipcode").Result = 5 is not going to work.

Len(ActiveDocument.FormFields("zipcode").Result ) = 5

will probably work as it will give you the length of the result.

It may however be better to use the IsNumeric() function as US Zip Codes are
numeric whereas Canadian ones are alpha-numeric.

Even in that case however, probably better to use

IsNumeric(Left(ActiveDocument.FormFields("zipcode" ).Result, 5)

as that will pickup 9 digit US Zip Codes (#####-####) which IsNumeric() by
itself may miss.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
s.com...
Doug:

Ok here is my code so far. What I'm trying to do is: if the zip code
form field is more than 5 digits (which is so for Canada) then hide
rows 22, 23 and 29 but if it is a USA zip code 5 digits, then show rows
22,23 and 29 and hide row 21.

Can you help me out as my code isn't working. Thanks a bunch!

Public Sub CanadaZipCode()

If ActiveDocument.FormFields("zipcode").Result = 5 Then
ActiveDocument.Unprotect
ActiveDocument.Tables(3).Rows(21).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(22).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(23).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(29).Range.Font.Hidde n = False
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset
Else
If ActiveDocument.FormFields("zipcode").Result 5 Then
ActiveDocument.Unprotect
ActiveDocument.Tables(3).Rows(21).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(22).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(23).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(29).Range.Font.Hidde n = True
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset



End If
End If

End Sub


Doug Robbins - Word MVP wrote:
You will have to include

ActiveDocument.Unprotect

and then later

ActiveDocument.Protect wdAllowOnlyFormFields, NoReset

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
oups.com...

wrote:
I have a Word 2003 form. There are multiple tables on the form. What
I want to do is to hide a selection of text in table #3, Row 27 if a
selection in Table 1, row 1, field10 is greater than 5 characters and
show another row of text.

I've looked through the postings and have not found anything quite
like
this.

Can anyone help me out with some code?

Thanks so much!

Oh and by the way, the form is protected. As I'm working through
trying to create this code it keeps giving me an error saying that the
section I have in the code is protected.

I really need some help on this.....anybody have any suggestions




  #7  
Old June 7th, 2006, 02:46 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Hide a row in a table based upon a previous selection

Doug:

Thanks so much. The form is working beautifully now!

Debbie


Doug Robbins - Word MVP wrote:
ActiveDocument.FormFields("zipcode").Result = 5 is not going to work.

Len(ActiveDocument.FormFields("zipcode").Result ) = 5

will probably work as it will give you the length of the result.

It may however be better to use the IsNumeric() function as US Zip Codes are
numeric whereas Canadian ones are alpha-numeric.

Even in that case however, probably better to use

IsNumeric(Left(ActiveDocument.FormFields("zipcode" ).Result, 5)

as that will pickup 9 digit US Zip Codes (#####-####) which IsNumeric() by
itself may miss.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
s.com...
Doug:

Ok here is my code so far. What I'm trying to do is: if the zip code
form field is more than 5 digits (which is so for Canada) then hide
rows 22, 23 and 29 but if it is a USA zip code 5 digits, then show rows
22,23 and 29 and hide row 21.

Can you help me out as my code isn't working. Thanks a bunch!

Public Sub CanadaZipCode()

If ActiveDocument.FormFields("zipcode").Result = 5 Then
ActiveDocument.Unprotect
ActiveDocument.Tables(3).Rows(21).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(22).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(23).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(29).Range.Font.Hidde n = False
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset
Else
If ActiveDocument.FormFields("zipcode").Result 5 Then
ActiveDocument.Unprotect
ActiveDocument.Tables(3).Rows(21).Range.Font.Hidde n = False
ActiveDocument.Tables(3).Rows(22).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(23).Range.Font.Hidde n = True
ActiveDocument.Tables(3).Rows(29).Range.Font.Hidde n = True
ActiveDocument.Protect wdAllowOnlyFormFields, NoReset



End If
End If

End Sub


Doug Robbins - Word MVP wrote:
You will have to include

ActiveDocument.Unprotect

and then later

ActiveDocument.Protect wdAllowOnlyFormFields, NoReset

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

wrote in message
oups.com...

wrote:
I have a Word 2003 form. There are multiple tables on the form. What
I want to do is to hide a selection of text in table #3, Row 27 if a
selection in Table 1, row 1, field10 is greater than 5 characters and
show another row of text.

I've looked through the postings and have not found anything quite
like
this.

Can anyone help me out with some code?

Thanks so much!

Oh and by the way, the form is protected. As I'm working through
trying to create this code it keeps giving me an error saying that the
section I have in the code is protected.

I really need some help on this.....anybody have any suggestions



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I establish a Many-to-Many Relationship jmcarroll7 Setting Up & Running Reports 13 February 24th, 2006 09:06 PM
Make Table Query - Sorting Errors Fred Running & Setting Up Queries 19 February 22nd, 2006 09:41 PM
Toolbars, Drop-Down Menus Rick New Users 1 September 21st, 2005 11:17 AM
Access combo box-show name, not ID, in table? write on New Users 30 April 30th, 2005 09:11 PM
Table Design A. Williams Database Design 3 April 29th, 2005 07:02 PM


All times are GMT +1. The time now is 07:39 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.