Hello again list.

In my document I have a form field that appears multiple times in the
document. I have the understanding that I need to use a REF field to display
it in the subsequent fields. I have this part nailed ok. The only problem is
I am adding the data with vb.net and the REF field is not being updated. SO
far I have tried these methods..

Doc.FormFields.Item("City").Result = "Sydney"
Doc.Fields.Update

City has 1 REF Field. This does not update the REF Field.
I have to go Into the document myself and right click the REF field and
click Update.

Any Ideas??

Thanks Nathan

Re: form fields and ref fields by Greg

Greg
Wed Apr 26 18:34:12 CDT 2006

The formfield bookmarked "City" can only appear once. You can have multiple
references to the bookmark using { REF City } or simply { City }

Unless you particularily want to set the value of the formfield with VBA,
you don't need VBA at all to update the references in the main text. Just
click the "calculate on exit" option in the formfield dialog box. If you do
want to set the value using VBA you can try:

Sub Test()
Dim Doc As Word.Document
Set Doc = ActiveDocument
Doc.FormFields("City").Result = "Sydney"
Doc.Fields.Update
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Nathan Franklin wrote:
> Hello again list.
>
> In my document I have a form field that appears multiple times in the
> document. I have the understanding that I need to use a REF field to
> display it in the subsequent fields. I have this part nailed ok. The
> only problem is I am adding the data with vb.net and the REF field is
> not being updated. SO far I have tried these methods..
>
> Doc.FormFields.Item("City").Result = "Sydney"
> Doc.Fields.Update
>
> City has 1 REF Field. This does not update the REF Field.
> I have to go Into the document myself and right click the REF field
> and click Update.
>
> Any Ideas??
>
> Thanks Nathan



Re: form fields and ref fields by Nathan

Nathan
Wed Apr 26 18:45:49 CDT 2006

Hey greg,

Thanks for your reply

I am using vb.net to generate a document, so I need to explicity set the
value's of the form fields. This works ok but the problem is the REF fields
arn't updating.

The calculate on exit is checked, But I dont think I am entering the field
because I am just setting the value. Is this assumption correct? How can I
explicity update the REF fields with VB

Thanks mate

Nathan

"Greg Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote in message
news:u2LpnnYaGHA.4784@TK2MSFTNGP02.phx.gbl...
> The formfield bookmarked "City" can only appear once. You can have
> multiple references to the bookmark using { REF City } or simply { City }
>
> Unless you particularily want to set the value of the formfield with VBA,
> you don't need VBA at all to update the references in the main text. Just
> click the "calculate on exit" option in the formfield dialog box. If you
> do want to set the value using VBA you can try:
>
> Sub Test()
> Dim Doc As Word.Document
> Set Doc = ActiveDocument
> Doc.FormFields("City").Result = "Sydney"
> Doc.Fields.Update
> End Sub
>
>
> --
> Greg Maxey/Word MVP
> See:
> http://gregmaxey.mvps.org/word_tips.htm
> For some helpful tips using Word.
>
>
> Nathan Franklin wrote:
>> Hello again list.
>>
>> In my document I have a form field that appears multiple times in the
>> document. I have the understanding that I need to use a REF field to
>> display it in the subsequent fields. I have this part nailed ok. The
>> only problem is I am adding the data with vb.net and the REF field is
>> not being updated. SO far I have tried these methods..
>>
>> Doc.FormFields.Item("City").Result = "Sydney"
>> Doc.Fields.Update
>>
>> City has 1 REF Field. This does not update the REF Field.
>> I have to go Into the document myself and right click the REF field
>> and click Update.
>>
>> Any Ideas??
>>
>> Thanks Nathan
>
>



Re: form fields and ref fields by Greg

Greg
Wed Apr 26 19:35:12 CDT 2006

Nathan,

I don't know what else to offer. I don't know anything about VB.net.

This works in a document using VBA. It sets the value of the formfield and
updates the REF fields in the main text story. Are you REF fields located
somewhere other than the main text story (e.g., headers or footers)?
> Sub Test()
> Dim Doc As Word.Document
> Set Doc = ActiveDocument
> Doc.FormFields("City").Result = "Sydney"
> Doc.Fields.Update
> End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Nathan Franklin wrote:
> Hey greg,
>
> Thanks for your reply
>
> I am using vb.net to generate a document, so I need to explicity set
> the value's of the form fields. This works ok but the problem is the
> REF fields arn't updating.
>
> The calculate on exit is checked, But I dont think I am entering the
> field because I am just setting the value. Is this assumption
> correct? How can I explicity update the REF fields with VB
>
> Thanks mate
>
> Nathan
>
> "Greg Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote in message
> news:u2LpnnYaGHA.4784@TK2MSFTNGP02.phx.gbl...
>> The formfield bookmarked "City" can only appear once. You can have
>> multiple references to the bookmark using { REF City } or simply {
>> City } Unless you particularily want to set the value of the formfield
>> with
>> VBA, you don't need VBA at all to update the references in the main
>> text. Just click the "calculate on exit" option in the formfield
>> dialog box. If you do want to set the value using VBA you can try:
>>
>> Sub Test()
>> Dim Doc As Word.Document
>> Set Doc = ActiveDocument
>> Doc.FormFields("City").Result = "Sydney"
>> Doc.Fields.Update
>> End Sub
>>
>>
>> --
>> Greg Maxey/Word MVP
>> See:
>> http://gregmaxey.mvps.org/word_tips.htm
>> For some helpful tips using Word.
>>
>>
>> Nathan Franklin wrote:
>>> Hello again list.
>>>
>>> In my document I have a form field that appears multiple times in
>>> the document. I have the understanding that I need to use a REF
>>> field to display it in the subsequent fields. I have this part
>>> nailed ok. The only problem is I am adding the data with vb.net and
>>> the REF field is not being updated. SO far I have tried these
>>> methods.. Doc.FormFields.Item("City").Result = "Sydney"
>>> Doc.Fields.Update
>>>
>>> City has 1 REF Field. This does not update the REF Field.
>>> I have to go Into the document myself and right click the REF field
>>> and click Update.
>>>
>>> Any Ideas??
>>>
>>> Thanks Nathan



Re: form fields and ref fields by Nathan

Nathan
Wed Apr 26 19:51:27 CDT 2006

Greg,
The ref fields are just located in the main storey. I guess I will just have
to have a play and see what I find...

Do you have to do soemthing different to update the header and footer
fields? I do have some other fields in the headers and footers, will I have
to use a different method.

thanks greg

nathan

"Greg Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote in message
news:eeIDtJZaGHA.5108@TK2MSFTNGP05.phx.gbl...
> Nathan,
>
> I don't know what else to offer. I don't know anything about VB.net.
>
> This works in a document using VBA. It sets the value of the formfield
> and updates the REF fields in the main text story. Are you REF fields
> located somewhere other than the main text story (e.g., headers or
> footers)?
>> Sub Test()
>> Dim Doc As Word.Document
>> Set Doc = ActiveDocument
>> Doc.FormFields("City").Result = "Sydney"
>> Doc.Fields.Update
>> End Sub
>
>
> --
> Greg Maxey/Word MVP
> See:
> http://gregmaxey.mvps.org/word_tips.htm
> For some helpful tips using Word.
>
>
> Nathan Franklin wrote:
>> Hey greg,
>>
>> Thanks for your reply
>>
>> I am using vb.net to generate a document, so I need to explicity set
>> the value's of the form fields. This works ok but the problem is the
>> REF fields arn't updating.
>>
>> The calculate on exit is checked, But I dont think I am entering the
>> field because I am just setting the value. Is this assumption
>> correct? How can I explicity update the REF fields with VB
>>
>> Thanks mate
>>
>> Nathan
>>
>> "Greg Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote in message
>> news:u2LpnnYaGHA.4784@TK2MSFTNGP02.phx.gbl...
>>> The formfield bookmarked "City" can only appear once. You can have
>>> multiple references to the bookmark using { REF City } or simply {
>>> City } Unless you particularily want to set the value of the formfield
>>> with
>>> VBA, you don't need VBA at all to update the references in the main
>>> text. Just click the "calculate on exit" option in the formfield
>>> dialog box. If you do want to set the value using VBA you can try:
>>>
>>> Sub Test()
>>> Dim Doc As Word.Document
>>> Set Doc = ActiveDocument
>>> Doc.FormFields("City").Result = "Sydney"
>>> Doc.Fields.Update
>>> End Sub
>>>
>>>
>>> --
>>> Greg Maxey/Word MVP
>>> See:
>>> http://gregmaxey.mvps.org/word_tips.htm
>>> For some helpful tips using Word.
>>>
>>>
>>> Nathan Franklin wrote:
>>>> Hello again list.
>>>>
>>>> In my document I have a form field that appears multiple times in
>>>> the document. I have the understanding that I need to use a REF
>>>> field to display it in the subsequent fields. I have this part
>>>> nailed ok. The only problem is I am adding the data with vb.net and
>>>> the REF field is not being updated. SO far I have tried these
>>>> methods.. Doc.FormFields.Item("City").Result = "Sydney"
>>>> Doc.Fields.Update
>>>>
>>>> City has 1 REF Field. This does not update the REF Field.
>>>> I have to go Into the document myself and right click the REF field
>>>> and click Update.
>>>>
>>>> Any Ideas??
>>>>
>>>> Thanks Nathan
>
>



Re: form fields and ref fields by Greg

Greg
Wed Apr 26 20:01:39 CDT 2006

Nathan,

Yes, see: 2.g.1. here:
http://gregmaxey.mvps.org/Repeating_Data.htm

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Nathan Franklin wrote:
> Greg,
> The ref fields are just located in the main storey. I guess I will
> just have to have a play and see what I find...
>
> Do you have to do soemthing different to update the header and footer
> fields? I do have some other fields in the headers and footers, will
> I have to use a different method.
>
> thanks greg
>
> nathan
>
> "Greg Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote in message
> news:eeIDtJZaGHA.5108@TK2MSFTNGP05.phx.gbl...
>> Nathan,
>>
>> I don't know what else to offer. I don't know anything about VB.net.
>>
>> This works in a document using VBA. It sets the value of the
>> formfield and updates the REF fields in the main text story. Are
>> you REF fields located somewhere other than the main text story
>> (e.g., headers or footers)?
>>> Sub Test()
>>> Dim Doc As Word.Document
>>> Set Doc = ActiveDocument
>>> Doc.FormFields("City").Result = "Sydney"
>>> Doc.Fields.Update
>>> End Sub
>>
>>
>> --
>> Greg Maxey/Word MVP
>> See:
>> http://gregmaxey.mvps.org/word_tips.htm
>> For some helpful tips using Word.
>>
>>
>> Nathan Franklin wrote:
>>> Hey greg,
>>>
>>> Thanks for your reply
>>>
>>> I am using vb.net to generate a document, so I need to explicity set
>>> the value's of the form fields. This works ok but the problem is the
>>> REF fields arn't updating.
>>>
>>> The calculate on exit is checked, But I dont think I am entering the
>>> field because I am just setting the value. Is this assumption
>>> correct? How can I explicity update the REF fields with VB
>>>
>>> Thanks mate
>>>
>>> Nathan
>>>
>>> "Greg Maxey" <gmaxey@mvps.oSCARrOMEOgOLF> wrote in message
>>> news:u2LpnnYaGHA.4784@TK2MSFTNGP02.phx.gbl...
>>>> The formfield bookmarked "City" can only appear once. You can have
>>>> multiple references to the bookmark using { REF City } or simply {
>>>> City } Unless you particularily want to set the value of the
>>>> formfield with
>>>> VBA, you don't need VBA at all to update the references in the main
>>>> text. Just click the "calculate on exit" option in the formfield
>>>> dialog box. If you do want to set the value using VBA you can try:
>>>>
>>>> Sub Test()
>>>> Dim Doc As Word.Document
>>>> Set Doc = ActiveDocument
>>>> Doc.FormFields("City").Result = "Sydney"
>>>> Doc.Fields.Update
>>>> End Sub
>>>>
>>>>
>>>> --
>>>> Greg Maxey/Word MVP
>>>> See:
>>>> http://gregmaxey.mvps.org/word_tips.htm
>>>> For some helpful tips using Word.
>>>>
>>>>
>>>> Nathan Franklin wrote:
>>>>> Hello again list.
>>>>>
>>>>> In my document I have a form field that appears multiple times in
>>>>> the document. I have the understanding that I need to use a REF
>>>>> field to display it in the subsequent fields. I have this part
>>>>> nailed ok. The only problem is I am adding the data with vb.net
>>>>> and the REF field is not being updated. SO far I have tried these
>>>>> methods.. Doc.FormFields.Item("City").Result = "Sydney"
>>>>> Doc.Fields.Update
>>>>>
>>>>> City has 1 REF Field. This does not update the REF Field.
>>>>> I have to go Into the document myself and right click the REF
>>>>> field and click Update.
>>>>>
>>>>> Any Ideas??
>>>>>
>>>>> Thanks Nathan