Solved

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

Posted on 2006-11-27
14
365 Views
Last Modified: 2012-05-05
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
Comment
Question by:nmcdermaid
  • 7
  • 3
  • 2
  • +2
14 Comments
 
LVL 7

Expert Comment

by:gbahri
ID: 18025460
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
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18025522
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
 
LVL 22

Expert Comment

by:Dreamboat
ID: 18025527
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
 
LVL 7

Expert Comment

by:gbahri
ID: 18025630
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
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18025867
Thanks guys. I gotta run now but I'll try it tommorow, it sounds like what I'm after!
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18033108
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
 
LVL 7

Expert Comment

by:gbahri
ID: 18034198
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 30

Author Comment

by:nmcdermaid
ID: 18035286
Thanks for that I'll give it a try tommorow.
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18050290
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 18057949
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
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18058263
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
 
LVL 4

Expert Comment

by:David Linker
ID: 18065359
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
 
LVL 4

Accepted Solution

by:
David Linker earned 500 total points
ID: 18065504
A Word .DOC containing this field is attached here:
https://filedb.experts-exchange.com/incoming/ee-stuff/1593-Next-Month.zip
0
 
LVL 30

Author Comment

by:nmcdermaid
ID: 18109864
Thats the ticket, thanks for that!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: dandraka
There are several quick shortcuts that can make your life easier in Microsoft Programs.  These simple tips and tricks will your work more productive and you faster at completing your tasks! MS Word (1) Creating Re-usable Scraps You can create s…
How many times recently have you prepared a presentation or emailed a document to a client and you have found that they have older versions of MS Office and they can not open the file you have prepared.  Although most visitors to this site are exper…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now