Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Field Codes
I've been messing with forms for too long today. I did go to the site that
many of you recommend such as: http://addbalance.com/word/movetotemplate.htm http://word.mvps.org/ I downloaded a couple of examples, but they didn't show what I was looking for. I managed to use Field codes to create an entry where you enter the birthday and it prints your age. But then I lost it and when I tried to toggle field codes, it would not come back because I had the data entered. I can't copy field codes from another file and paste it in. Is there a way to do it so I don't have to retype everything? Plus, I would like the birth date to go into one table cell and the age in another. I can only make them appear in the same cell using the Field code insert. How do you separate them out? I am sure macros are a good way to go... have not quite got them figured out yet. Thanks. Meryl -- http://www.meryl.net/blog/ |
#2
|
|||
|
|||
Date calculations using fields are complex. The instructions for doing this
and the field codes to copy to your document can be found at http://www.wopr.com/cgi-bin/w3t/show...?Number=249902. Based on this article, you can amend the code to run from a form field. Call the formfield BirthDate, set is properties as a date type of field and set the calculate on exit check box. In the body of the text at the place ytou want the field, you need to create the following construction. (Copy it from the aforementioned article and paste it to your document - then amend it to match. Simply copying from this newsgroup posting will not work). {QUOTE {SET by {BirthDate \@ yyyy}} {SET bm {BirthDate \@ M}} {SET bd {BirthDate \@ d}} {SET yy {DATE \@ yyyy}} {SET mm {DATE \@ M}} {SET dd {DATE \@ d}} {SET md{=IF((mm=2),28+(mm=2)*((MOD(yy,4)=0)+(MOD(yy,400 )=0)-(MOD(yy,100)=0)),31-( (mm=4)+(mm=6)+(mm=9)+(mm=11)))}} {Set Years{=yy-by-(mmbm)-(mm=bm)*(ddbd)}} {Years}" Year{IF{Years}= 1 "" s}"} -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Meryl wrote: I've been messing with forms for too long today. I did go to the site that many of you recommend such as: http://addbalance.com/word/movetotemplate.htm http://word.mvps.org/ I downloaded a couple of examples, but they didn't show what I was looking for. I managed to use Field codes to create an entry where you enter the birthday and it prints your age. But then I lost it and when I tried to toggle field codes, it would not come back because I had the data entered. I can't copy field codes from another file and paste it in. Is there a way to do it so I don't have to retype everything? Plus, I would like the birth date to go into one table cell and the age in another. I can only make them appear in the same cell using the Field code insert. How do you separate them out? I am sure macros are a good way to go... have not quite got them figured out yet. Thanks. Meryl |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I turn off field codes in an MS Word document? | Microsoft Word Help | |||
Toggle field codes. | New Users | |||
Typing If Field Codes | Microsoft Word Help | |||
HOW TO HIDE Field Codes automatically? | Mailmerge | |||
Word Field Codes in Excel data file | Mailmerge |