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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
ASK Field Behavior
I was doing some experimenting and stumbled on some odd
ASK field behavior and was hoping someone could explain what is going on under Word's hood. I put {ASK Name "What is your name?"} in the body of a document and {REF Name} in the header. All is well. I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately FOLLOWING the ASK field bookmark indicator and the REF field results will not display. Odd. I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately PRECEEDING the ASK field bookmark indicator and the REF field results will display but only after I fire the prompt (F9) and respond a second time. Very odd. Can anyone explain the reason for this behavior? Thank you. |
#2
|
|||
|
|||
ASK Field Behavior
I put {ASK Age "How old are you?"} in the HEADER of a
document and {REF Age} immediately FOLLOWING the ASK field bookmark indicator and the REF field results will not display. Odd. I don't get this here (Word 2003). I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately PRECEEDING the ASK field bookmark indicator and the REF field results will display but only after I fire the prompt (F9) and respond a second time. Very odd. Broadly speaking, this is because Word executes the field codes in the sequence they appear in the text. If you select the whole header and press F9, when Word tries to execute the REF field, no Age bookmark exists yet. Word will typically display "Error! Reference source not found." Then WOrd will execute the ASK field, which will result in the creation of the ASK bookmark. Word won't go back and re-execute the REF field. In fact, it doesn't even execute it when you print with the Print|Update Fields option set. But if you carefully select the REF field and press F9, you should see Word insert the value you specified when you responded to the ASK. Peter Jamieson |
#4
|
|||
|
|||
ASK Field Behavior
Greg, move the ASK field to the body of the document. Then it should work
pretty well. -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://www.mvps.org/word which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "Greg Maxey" wrote in message . .. Peter, I was using Word 2000, but I am at home now and still and see the same behavior. I have {REF Age}{ASK Age "How old are you?"}{Ref Age} in the document header. The first REF field generates the error you mention on first attempt to update and the displays on the second update. The REF field following the ASK field will not display. I see the same behavior if I separate the ASK and REF field with text {REF Age}{ASK Age "How old are you?"} XXXX {Ref Age} If I cut and paste the ASK field into the main document and update, both REF fields in the header update and display normally. If I cut and paste the ASK field back in between the two REF fields, the first will udate on the second attempt but the second REF field retains and displays the previous value and will not update. Very odd???? A REF Field in the main document or footer visually following the ASK field updates and displays normally. -- Greg Maxey A peer in "peer to peer" support Rockledge, FL To e-mail, edit out the "w...spam" in Peter Jamieson wrote: I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately FOLLOWING the ASK field bookmark indicator and the REF field results will not display. Odd. I don't get this here (Word 2003). I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately PRECEEDING the ASK field bookmark indicator and the REF field results will display but only after I fire the prompt (F9) and respond a second time. Very odd. Broadly speaking, this is because Word executes the field codes in the sequence they appear in the text. If you select the whole header and press F9, when Word tries to execute the REF field, no Age bookmark exists yet. Word will typically display "Error! Reference source not found." Then WOrd will execute the ASK field, which will result in the creation of the ASK bookmark. Word won't go back and re-execute the REF field. In fact, it doesn't even execute it when you print with the Print|Update Fields option set. But if you carefully select the REF field and press F9, you should see Word insert the value you specified when you responded to the ASK. Peter Jamieson |
#5
|
|||
|
|||
ASK Field Behavior
Charles,
Yes I have noticed that, I am just confounded by the behavior. Especially after Peter commented that he wasn't experiencing it. I am using Word2003 here and that following REF field just won't update or display :-( -- Greg Maxey A peer in "peer to peer" support Rockledge, FL To e-mail, edit out the "w...spam" in Charles Kenyon wrote: Greg, move the ASK field to the body of the document. Then it should work pretty well. "Greg Maxey" wrote in message . .. Peter, I was using Word 2000, but I am at home now and still and see the same behavior. I have {REF Age}{ASK Age "How old are you?"}{Ref Age} in the document header. The first REF field generates the error you mention on first attempt to update and the displays on the second update. The REF field following the ASK field will not display. I see the same behavior if I separate the ASK and REF field with text {REF Age}{ASK Age "How old are you?"} XXXX {Ref Age} If I cut and paste the ASK field into the main document and update, both REF fields in the header update and display normally. If I cut and paste the ASK field back in between the two REF fields, the first will udate on the second attempt but the second REF field retains and displays the previous value and will not update. Very odd???? A REF Field in the main document or footer visually following the ASK field updates and displays normally. -- Greg Maxey A peer in "peer to peer" support Rockledge, FL To e-mail, edit out the "w...spam" in Peter Jamieson wrote: I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately FOLLOWING the ASK field bookmark indicator and the REF field results will not display. Odd. I don't get this here (Word 2003). I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately PRECEEDING the ASK field bookmark indicator and the REF field results will display but only after I fire the prompt (F9) and respond a second time. Very odd. Broadly speaking, this is because Word executes the field codes in the sequence they appear in the text. If you select the whole header and press F9, when Word tries to execute the REF field, no Age bookmark exists yet. Word will typically display "Error! Reference source not found." Then WOrd will execute the ASK field, which will result in the creation of the ASK bookmark. Word won't go back and re-execute the REF field. In fact, it doesn't even execute it when you print with the Print|Update Fields option set. But if you carefully select the REF field and press F9, you should see Word insert the value you specified when you responded to the ASK. Peter Jamieson |
#6
|
|||
|
|||
ASK Field Behavior
FWIW I experience the same 'problem' here with Word 2003.
Update of fields in headers has always been a bit hit and miss. The only way I was able to get this to display correctly was to modify my update macro to use two techniques - the first to update the fields and the second to switch print preview which forces the first field to display correctly without forcing the prompt on the ask field for a second time. Sub UpdateAll() Dim oStory As Range Dim oField As Field For Each oStory In ActiveDocument.StoryRanges For Each oField In oStory.Fields oField.Update Next oField Next oStory Options.UpdateFieldsAtPrint = True Application.ScreenUpdating = False PrintPreview = True PrintPreview = False ActiveDocument.ActiveWindow.View.Type = wdPrintView Application.ScreenUpdating = True End Sub -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Greg Maxey wrote: Charles, Yes I have noticed that, I am just confounded by the behavior. Especially after Peter commented that he wasn't experiencing it. I am using Word2003 here and that following REF field just won't update or display :-( Charles Kenyon wrote: Greg, move the ASK field to the body of the document. Then it should work pretty well. "Greg Maxey" wrote in message . .. Peter, I was using Word 2000, but I am at home now and still and see the same behavior. I have {REF Age}{ASK Age "How old are you?"}{Ref Age} in the document header. The first REF field generates the error you mention on first attempt to update and the displays on the second update. The REF field following the ASK field will not display. I see the same behavior if I separate the ASK and REF field with text {REF Age}{ASK Age "How old are you?"} XXXX {Ref Age} If I cut and paste the ASK field into the main document and update, both REF fields in the header update and display normally. If I cut and paste the ASK field back in between the two REF fields, the first will udate on the second attempt but the second REF field retains and displays the previous value and will not update. Very odd???? A REF Field in the main document or footer visually following the ASK field updates and displays normally. -- Greg Maxey A peer in "peer to peer" support Rockledge, FL To e-mail, edit out the "w...spam" in Peter Jamieson wrote: I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately FOLLOWING the ASK field bookmark indicator and the REF field results will not display. Odd. I don't get this here (Word 2003). I put {ASK Age "How old are you?"} in the HEADER of a document and {REF Age} immediately PRECEEDING the ASK field bookmark indicator and the REF field results will display but only after I fire the prompt (F9) and respond a second time. Very odd. Broadly speaking, this is because Word executes the field codes in the sequence they appear in the text. If you select the whole header and press F9, when Word tries to execute the REF field, no Age bookmark exists yet. Word will typically display "Error! Reference source not found." Then WOrd will execute the ASK field, which will result in the creation of the ASK bookmark. Word won't go back and re-execute the REF field. In fact, it doesn't even execute it when you print with the Print|Update Fields option set. But if you carefully select the REF field and press F9, you should see Word insert the value you specified when you responded to the ASK. Peter Jamieson |
#7
|
|||
|
|||
ASK Field Behavior
Graham Mayor wrote:
FWIW I experience the same 'problem' here with Word 2003. Update of fields in headers has always been a bit hit and miss. The only way I was able to get this to display correctly was to modify my update macro to use two techniques - the first to update the fields and the second to switch print preview which forces the first field to display correctly without forcing the prompt on the ask field for a second time. Sub UpdateAll() Dim oStory As Range Dim oField As Field For Each oStory In ActiveDocument.StoryRanges For Each oField In oStory.Fields oField.Update Next oField Next oStory Options.UpdateFieldsAtPrint = True Application.ScreenUpdating = False PrintPreview = True PrintPreview = False ActiveDocument.ActiveWindow.View.Type = wdPrintView Application.ScreenUpdating = True End Sub Curious, isn't it? I have no problem either on Word 2000 or Word 2003, either using manual updates or the for next loop with no additional code. But I am using a very simple example. Peter Jamieson |
#8
|
|||
|
|||
ASK Field Behavior
Having re-read Greg's first message, I have to say I don't get the problem
with the second REF field, only the reluctance of the first one to update. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Peter Jamieson wrote: Graham Mayor wrote: FWIW I experience the same 'problem' here with Word 2003. Update of fields in headers has always been a bit hit and miss. The only way I was able to get this to display correctly was to modify my update macro to use two techniques - the first to update the fields and the second to switch print preview which forces the first field to display correctly without forcing the prompt on the ask field for a second time. Sub UpdateAll() Dim oStory As Range Dim oField As Field For Each oStory In ActiveDocument.StoryRanges For Each oField In oStory.Fields oField.Update Next oField Next oStory Options.UpdateFieldsAtPrint = True Application.ScreenUpdating = False PrintPreview = True PrintPreview = False ActiveDocument.ActiveWindow.View.Type = wdPrintView Application.ScreenUpdating = True End Sub Curious, isn't it? I have no problem either on Word 2000 or Word 2003, either using manual updates or the for next loop with no additional code. But I am using a very simple example. Peter Jamieson |
#9
|
|||
|
|||
ASK Field Behavior
Hi Graham et al,
You can solve the problem of the REF field in the header not displaying by wrapping both fields with a QUOTE field, as in: {QUOTE{ASK Age "How old are you?"}{Age}} To suppress the 'Error! Bookmark not defined.' message before the ASK has been answered, simply put an empty 'Age' bookmark immediately before the field. Cheers "Graham Mayor" wrote in message ... Having re-read Greg's first message, I have to say I don't get the problem with the second REF field, only the reluctance of the first one to update. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Peter Jamieson wrote: Graham Mayor wrote: FWIW I experience the same 'problem' here with Word 2003. Update of fields in headers has always been a bit hit and miss. The only way I was able to get this to display correctly was to modify my update macro to use two techniques - the first to update the fields and the second to switch print preview which forces the first field to display correctly without forcing the prompt on the ask field for a second time. Sub UpdateAll() Dim oStory As Range Dim oField As Field For Each oStory In ActiveDocument.StoryRanges For Each oField In oStory.Fields oField.Update Next oField Next oStory Options.UpdateFieldsAtPrint = True Application.ScreenUpdating = False PrintPreview = True PrintPreview = False ActiveDocument.ActiveWindow.View.Type = wdPrintView Application.ScreenUpdating = True End Sub Curious, isn't it? I have no problem either on Word 2000 or Word 2003, either using manual updates or the for next loop with no additional code. But I am using a very simple example. Peter Jamieson --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.711 / Virus Database: 467 - Release Date: 25/06/2004 |
#10
|
|||
|
|||
ASK Field Behavior
Macropod,
You sure do know your field business. Thanks for the tip. I was completely dumbfounded as to why I was seeing such odd behavior with both Word2000 and Word2003 after Peter and Graham replied. I started digging and realized that a year or so ago I substituted the following macro for Word's built-in UpdateFields command on both my office and home computer. Sub UpdateFields() 'Updates All Fields in Active Document Created by Graham Mayor Dim oStory As Range For Each oStory In ActiveDocument.StoryRanges oStory.Fields.Update If oStory.StoryType wdMainTextStory Then While Not (oStory.NextStoryRange Is Nothing) Set oStory = oStory.NextStoryRange oStory.Fields.Update Wend End If Next oStory Set oStory = Nothing End Sub I removed the macro and restored the original UpdateFields command to the F9 function and things straightened out :-). Oddly enoungh I went back and restored the macro to the F9 function and things are still working normally. I don't understand what happened, but it appears to be normal now. Thanks again. -- Greg Maxey A peer in "peer to peer" support Rockledge, FL To e-mail, edit out the "w...spam" in macropod wrote: Hi Graham et al, You can solve the problem of the REF field in the header not displaying by wrapping both fields with a QUOTE field, as in: {QUOTE{ASK Age "How old are you?"}{Age}} To suppress the 'Error! Bookmark not defined.' message before the ASK has been answered, simply put an empty 'Age' bookmark immediately before the field. Cheers "Graham Mayor" wrote in message ... Having re-read Greg's first message, I have to say I don't get the problem with the second REF field, only the reluctance of the first one to update. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Peter Jamieson wrote: Graham Mayor wrote: FWIW I experience the same 'problem' here with Word 2003. Update of fields in headers has always been a bit hit and miss. The only way I was able to get this to display correctly was to modify my update macro to use two techniques - the first to update the fields and the second to switch print preview which forces the first field to display correctly without forcing the prompt on the ask field for a second time. Sub UpdateAll() Dim oStory As Range Dim oField As Field For Each oStory In ActiveDocument.StoryRanges For Each oField In oStory.Fields oField.Update Next oField Next oStory Options.UpdateFieldsAtPrint = True Application.ScreenUpdating = False PrintPreview = True PrintPreview = False ActiveDocument.ActiveWindow.View.Type = wdPrintView Application.ScreenUpdating = True End Sub Curious, isn't it? I have no problem either on Word 2000 or Word 2003, either using manual updates or the for next loop with no additional code. But I am using a very simple example. Peter Jamieson --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.711 / Virus Database: 467 - Release Date: 25/06/2004 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Field list greyed out when trying to add an option group | Tony | Using Forms | 1 | July 1st, 2004 03:40 AM |
NUMBERING the pages | Bob | New Users | 7 | June 14th, 2004 12:20 AM |
2 Qs: Calculated Field & Composite Unique Index | David F | New Users | 2 | June 6th, 2004 09:03 PM |
field manipulation | Steve | Running & Setting Up Queries | 2 | May 28th, 2004 03:12 PM |
lookup field | rvmom | New Users | 2 | May 23rd, 2004 03:06 AM |