Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Field code for previous month

1,473 views
Skip to first unread message

Brad

unread,
Aug 27, 2003, 2:40:08 PM8/27/03
to
Hi all,

I get the impression that this should be really simple but it feels
like I've been banging my head against a brick wall for ages.

I'm running Word 97 on NT4 and the help files says that I can get the
previous month by using the field code -

{ QUOTE { IF { DATE \@ "M" } = 1 "12" " {= { DATE \@ "M" } -1 } "
}/1/95 \@ "MMMM" }

but I keep getting this error message "Error! Too many picture
switches defined." I can't find the error message anywhere in the
help files and I've tried changing the above but to no avail.

Is this a bug in Word 97 or am I just being stupid.

Thanks in advance for any gracious assistance.

Brad

macropod

unread,
Aug 28, 2003, 6:07:35 AM8/28/03
to
Hi Brad,

Since you're comfortable coding fields, enter one as
follows:
{QUOTE{SET Delay -1}{SET m{=MOD({DATE \@ "MM"}+Delay-
1,12)+1}}{SET d{=IF(AND(m=2,{DATE \@ "dd"}>28),28,IF
(AND(OR(OR(m=4,m=6),OR(m=9,m=11)),{DATE \@ "dd"}
>30),30,{DATE \@ "dd"}))}}{SET y{={DATE \@ "YYYY"}
+INT((Delay+{DATE \@ "MM"}-1)/12)}}{SET mm"{m}/00"}
{d}160{mm \@ "MMMM"}160{y}}
for a field that outputs next month's date in "28
July 2003" format.

Otherwise, go to:
http://www.wopr.com/cgi-bin/w3t/showflat.pl?
Cat=&Board=wrd&Number=249902
where you'll find a Word document with fields for doing
this, and much more, with dates, as well as explanations
on how to vary the output formats.

Cheers
PS: Remove NO.SPAM from the above before replying.

>.
>

Geoffrey Oakes

unread,
Aug 28, 2003, 7:07:53 AM8/28/03
to
Brad:

I tried your field code on my Word 97 / NT 4 system and it worked correctly.

Then I entered the { QUOTE } field by using Insert->Field, but deliberately
made an error by entering the contents ({ IF { DATE \@ "M" } = 1 "12" " {=
{ DATE \@ "M" } -1 } " }/1/95 \@ "MMMM") as text rather than by inserting
the IF, DATE and = fields. This resulted in the same message you are
seeing - "Error! Too many picture switches defined.".

Hope this helps,
Geoff


"Brad" <brads...@yahoo.com> wrote in message
news:8bf09df4.03082...@posting.google.com...

macropod

unread,
Aug 29, 2003, 7:43:55 AM8/29/03
to
Hi Brad,

I've realised that the solution in my previous post may
have been much more than you were looking for. That
solution gives the full date (ie day month and year).

Your immediate problem is probably caused by typing in
some of the braces (i.e. {}) but they all have to be input
as pairs via Ctrl-F9.

Anyway, if all you want is the previous month, a simpler
field would be:
{QUOTE{SET m"{=MOD({DATE \@ "MM"}-2,12)+1}/00"}{m
\@ "MMMM"}}
Note there are 5 nested pairs of braces to insert via Ctrl-
F9. A more flexible version of this also appears in the
file cited in my previous post.

Cheers
PS: Remove NO.SPAM from the above before replying.

>.
>

macropod

unread,
Aug 29, 2003, 7:57:38 AM8/29/03
to
Or, even simpler:
{QUOTE{=MOD({DATE \@ "MM"}-2,12)+1}/00 \@ MMMM}
Only 3 nested fields!

Cheers
PS: Remove NO.SPAM from the above before replying.

>.
>

0 new messages