Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 375
  • Last Modified:

Is there a Word merge code to show next month instead of the current month

I am currently using this field code to get the current month:

{DATE \@ "MMMM YYYY" \* MERGEFORMAT }

Which shows

November 2006


Is there a field code that I can enter to show next months date?

i.e.

December 2006


I basically need to alter the field to add one month to the current  date, so I guess if its possible it would be something like this:


{ADDMONTH(DATE,1) \@ "MMMM YYYY" \* MERGEFORMAT }
0
nmcdermaid
Asked:
nmcdermaid
  • 7
  • 3
  • 2
  • +2
1 Solution
 
gbahriCommented:
Hi nmcdermaid,

Try this field code:

{ QUOTE { IF { DATE \@ "M"}= 1 "12" "{={DATE \@ "M" }+1}"}/1/{DATE \@ "YYYY"} \@ "MMMM YYYY" \* MERGEFORMAT}

Hope, this is what you were looking for,

Thanks,

GBahri
0
 
nmcdermaidAuthor Commented:
It probably is what I want, but MS Word won't accept it.

In the 'field' dialog box, the OK button is greyed out when I paste that string in.

It isn't greyed out when I just paste DATE in.

Therefore there may be an issue with opening/closing brackets and or quotes? I'm not too familiar with this type of syntax, it may be quicker if you could take another look.

... plus I'm in Australia here so maybe the date format when concatenating the string needs to d/m/y instead of m/d/y
0
 
DreamboatCommented:
To insert a set of the { } brackets, you must use Ctrl+F9. You cannot copy/paste them.

So, edit the existing merge field by changing it to say QUOTE, then hit space, then Ctrl+F9, then type IF, etc...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gbahriCommented:
For each pair of {} you'll have to use Ctrl+F9 as Dreamboat has said. Your field code should match with string so as to work correctly. For the Date part, I dont' think that will create any problem, give this a try.

Thanks,

GBahri
0
 
nmcdermaidAuthor Commented:
Thanks guys. I gotta run now but I'll try it tommorow, it sounds like what I'm after!
0
 
nmcdermaidAuthor Commented:
OK, I've created a field with just "DATE" in it, then I've hit "toggle field codes" and edited it.

Using CTRL-F9 (noting that it inserts BOLDED braces) I have entered the above formula. Then I hit 'toggle field codes' ....

its just showing todays date:


29/11/2006


The curious thing is if I flick back to the field code or copy and paste, it changes it to this:

{ QUOTE /1/ \@ "MMMM YYYY" \*}


.. which is a nice suprise after I laboriously typed it in!

Is there a way we can break this into bits to check which segment is causing issues?
0
 
gbahriCommented:
Hi,

I think you are missing some field codes. You'll have to replicate each bit as it is. All the paired curly braces '{ }' denotes field code (you'll have to use Ctrl-F9. Altogether, there are Six field codes). I'm also attaching a zipped word file with above working field code. If you wish, you can copy field code from this document, its working fine.

https://filedb.experts-exchange.com/incoming/ee-stuff/1539-nmcdermaid.zip

cheers,

GBahri
0
 
nmcdermaidAuthor Commented:
Thanks for that I'll give it a try tommorow.
0
 
nmcdermaidAuthor Commented:
OK, its almost working except for the position of the month.

Basically its stuck on January because the MMMM format string is picking up the /1/ in the middle. The first number (which is the day in Australian format) is definitely moving along correctly.


Therefore it definitely needs to be in Australian format:

How do I move the /1/ to the front:

for example,

1/4/2007 for an input of March 2006  as opposed to 4/1/2007


I've tried messing with the codes but to no avail.


Thanks for your assistance so far, I'm learning a lot.
0
 
GrahamSkanCommented:
Strewth Bruce,
Without getting too involved, in Pommieland our name for the fourth month is April. I guess there's more to Oz than just being excellent at team games.
;)
0
 
nmcdermaidAuthor Commented:
LOL Crikey!

But when you add one to the month March becomes April (as per the original question), so I guess we both see these things slightly differently :)



0
 
David LinkerCommented:
From a fellow Aussie:

{ QUOTE "1/"{ IF { DATE \@ "M"}= 12 "1" "{={DATE \@ "M" }+1}"}"/"{ IF { DATE \@ "M" }= 12 {={ DATE \@ "yyyy" }+1 {DATE \@ "yyyy"} } \@ "MMMM yyyy" \* MERGEFORMAT}

Note - the original answer while helpful checked for January then made it December - when you need to check for December and make it January.  You also have to increment the year by one if it is December.  I fixed both these errors.

The field codes that keep "disappearing" after you type it in - you need to highlight just the text representing the "disappearing" code and press shift-F9 to make that piece visible as a code instead of it's value

I've also moved the month in to the middle to cope with our Aussie date format :-)
This will give you the answer you're after.  Note that the space is important - especially the space betweeen the = and 12 - which occurs in two places.




0
 
David LinkerCommented:
A Word .DOC containing this field is attached here:
https://filedb.experts-exchange.com/incoming/ee-stuff/1593-Next-Month.zip 
0
 
nmcdermaidAuthor Commented:
Thats the ticket, thanks for that!
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 7
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now