Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jamie
 
Posts: n/a
Default Previous Year in a Date Field

I'm using Word 2002.

I have a date field, the date format is MMMM yyyy. If I enter 10/04 the
field shows October 2005, it doesn't accept any previous year. I need the
user to be able to enter information from any month of a previous year to any
current month year. How can I get the field to accept the previous year(s)?

Thanks for your help.
--
Jamie
  #2   Report Post  
Jay Freedman
 
Posts: n/a
Default

Jamie wrote:
I'm using Word 2002.

I have a date field, the date format is MMMM yyyy. If I enter 10/04
the field shows October 2005, it doesn't accept any previous year. I
need the user to be able to enter information from any month of a
previous year to any current month year. How can I get the field to
accept the previous year(s)?

Thanks for your help.


Word is guessing about how to interpret what you typed, and it's guessing
wrong. You'll have to supply the "smarts" yourself...

When you enter 10/04 in the field, Word assumes that these are the month and
the *day* (or vice versa, depending on your Regional date settings in
Windows), and goes on from there to assume that you omitted the year so you
must have meant this year. Hence the result October 2005.

If the second part of the date clearly can't be a day number -- for example,
10/95 -- then the field guesses that it must be the last two digits of a
year beginning with '19'. It isn't programmed to assume a year beginning
with '20' at all.

You can either enter all three parts of the date (choosing any day, as that
will be discarded) as 10/1/04 or you can enter the year as all four digits,
10/2004. Either of those entries will display a result of October 2004. I
can't think of any way to force the field to recognize your entry the way
you intended in all circumstances.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org


  #3   Report Post  
Jamie
 
Posts: n/a
Default

Hi Jay, thanks for your response. Can I use an on entry macro to show the
date that is entered by the user? If so, how would I go about doing this.

"Jay Freedman" wrote:

Jamie wrote:
I'm using Word 2002.

I have a date field, the date format is MMMM yyyy. If I enter 10/04
the field shows October 2005, it doesn't accept any previous year. I
need the user to be able to enter information from any month of a
previous year to any current month year. How can I get the field to
accept the previous year(s)?

Thanks for your help.


Word is guessing about how to interpret what you typed, and it's guessing
wrong. You'll have to supply the "smarts" yourself...

When you enter 10/04 in the field, Word assumes that these are the month and
the *day* (or vice versa, depending on your Regional date settings in
Windows), and goes on from there to assume that you omitted the year so you
must have meant this year. Hence the result October 2005.

If the second part of the date clearly can't be a day number -- for example,
10/95 -- then the field guesses that it must be the last two digits of a
year beginning with '19'. It isn't programmed to assume a year beginning
with '20' at all.

You can either enter all three parts of the date (choosing any day, as that
will be discarded) as 10/1/04 or you can enter the year as all four digits,
10/2004. Either of those entries will display a result of October 2004. I
can't think of any way to force the field to recognize your entry the way
you intended in all circumstances.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



  #4   Report Post  
Jay Freedman
 
Posts: n/a
Default

Hi Jamie,

Do you mean this: after the user enters something like 10/2004 and tabs out
of the field, and the field reformats it to October 2004, then the user
reenters the field, and you want to somehow show the original typed value
10/2004?

If that's what you want, the answer is "sorry, no, not with this kind of
field". The field has no memory of what was typed; all it retains is the
final formatted display.

If you really need something like this, it will be much more complicated.
Set the field's Type property to "regular text" instead of "Date". Create an
exit macro that first stores the user's typed entry in a document variable
and then validates and reformats the entry (reinventing the wheel to
duplicate the Date field's automatic processing). Then you can write a
separate entry macro that retrieves the value of the document variable and
displays it (in the original form field, a message box, a userform, or the
status bar -- designer's choice).

Also be aware that including macros means that the document will trigger the
macro security warning whenever it's opened.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

Jamie wrote:
Hi Jay, thanks for your response. Can I use an on entry macro to
show the date that is entered by the user? If so, how would I go
about doing this.

"Jay Freedman" wrote:

Jamie wrote:
I'm using Word 2002.

I have a date field, the date format is MMMM yyyy. If I enter 10/04
the field shows October 2005, it doesn't accept any previous year.
I need the user to be able to enter information from any month of a
previous year to any current month year. How can I get the field to
accept the previous year(s)?

Thanks for your help.


Word is guessing about how to interpret what you typed, and it's
guessing wrong. You'll have to supply the "smarts" yourself...

When you enter 10/04 in the field, Word assumes that these are the
month and the *day* (or vice versa, depending on your Regional date
settings in Windows), and goes on from there to assume that you
omitted the year so you must have meant this year. Hence the result
October 2005.

If the second part of the date clearly can't be a day number -- for
example, 10/95 -- then the field guesses that it must be the last
two digits of a year beginning with '19'. It isn't programmed to
assume a year beginning with '20' at all.

You can either enter all three parts of the date (choosing any day,
as that will be discarded) as 10/1/04 or you can enter the year as
all four digits, 10/2004. Either of those entries will display a
result of October 2004. I can't think of any way to force the field
to recognize your entry the way you intended in all circumstances.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org



  #5   Report Post  
Jamie
 
Posts: n/a
Default

Ok, thanks for your help Jay.

"Jay Freedman" wrote:

Hi Jamie,

Do you mean this: after the user enters something like 10/2004 and tabs out
of the field, and the field reformats it to October 2004, then the user
reenters the field, and you want to somehow show the original typed value
10/2004?

If that's what you want, the answer is "sorry, no, not with this kind of
field". The field has no memory of what was typed; all it retains is the
final formatted display.

If you really need something like this, it will be much more complicated.
Set the field's Type property to "regular text" instead of "Date". Create an
exit macro that first stores the user's typed entry in a document variable
and then validates and reformats the entry (reinventing the wheel to
duplicate the Date field's automatic processing). Then you can write a
separate entry macro that retrieves the value of the document variable and
displays it (in the original form field, a message box, a userform, or the
status bar -- designer's choice).

Also be aware that including macros means that the document will trigger the
macro security warning whenever it's opened.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

Jamie wrote:
Hi Jay, thanks for your response. Can I use an on entry macro to
show the date that is entered by the user? If so, how would I go
about doing this.

"Jay Freedman" wrote:

Jamie wrote:
I'm using Word 2002.

I have a date field, the date format is MMMM yyyy. If I enter 10/04
the field shows October 2005, it doesn't accept any previous year.
I need the user to be able to enter information from any month of a
previous year to any current month year. How can I get the field to
accept the previous year(s)?

Thanks for your help.

Word is guessing about how to interpret what you typed, and it's
guessing wrong. You'll have to supply the "smarts" yourself...

When you enter 10/04 in the field, Word assumes that these are the
month and the *day* (or vice versa, depending on your Regional date
settings in Windows), and goes on from there to assume that you
omitted the year so you must have meant this year. Hence the result
October 2005.

If the second part of the date clearly can't be a day number -- for
example, 10/95 -- then the field guesses that it must be the last
two digits of a year beginning with '19'. It isn't programmed to
assume a year beginning with '20' at all.

You can either enter all three parts of the date (choosing any day,
as that will be discarded) as 10/1/04 or you can enter the year as
all four digits, 10/2004. Either of those entries will display a
result of October 2004. I can't think of any way to force the field
to recognize your entry the way you intended in all circumstances.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
using date field in merge Henri Vrancken Mailmerge 3 March 5th 05 01:52 PM
Updating a date field LDHardy Microsoft Word Help 2 February 25th 05 04:07 PM
Form Field - Type Date webnut Microsoft Word Help 4 January 25th 05 03:48 PM
inserting a date field for a future date rm Microsoft Word Help 2 January 10th 05 07:18 PM
Date issue merging from Excel field in Date format to Word Barb Reinhardt Mailmerge 1 December 17th 04 07:34 AM


All times are GMT +1. The time now is 06:04 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"