Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
ChrisM
 
Posts: n/a
Default Displaying consecutive Dates On A Form

MSWord 2000, XP Professional

Hi,

I have a document that is basically a form with a section for each day of
the week.
Currently, every week I have to change all seven dates before printing the
document. What I would like is to be able to enter the first date and have
all the rest calculated automatically.
I have got as far as a single Form Field to enter the first date. I'm now
trying to insert Formula fields for the rest.
The FirstDate (Form Field) is defined as type 'Date', is set to 'Calculate
on Exit' and has a name in the BookMark field setting ('MyDate')
The first Formula Field looks somthing like {=MyDate+1 \@"dd/MM/yy}.
I then set document protection to 'Forms'
When I enter a date in the FormField, the formula field changes to TODAYS
date, regardless of the FormField date. Anyone help me out here?

Note: It has to be a entered date, and not based on the current date, as it
can vary when this form is required, and the start date is not usually
todays date, or a fixed deviation from it.

Cheers,

ChrisM.


  #2   Report Post  
Posted to microsoft.public.word.newusers
macropod
 
Posts: n/a
Default Displaying consecutive Dates On A Form

Hi Chris,

You could do this sort of thing with formula fields, and the topic
'Calculate a Stepped Date Range' in my Date Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902
shows how one might go about this. If you look it up, you'll find the field
computations are far more complex than one might expect - because Word
wasn't designed with this sort of thing in mind.

For your purposes, a macro driven by the 'run macro on exit' property might
do the job with a lot less bother. For starters, the new dates could be
calculated by the vba DateAdd function, which does in one line of code what
umpteen lines of field coding are otherwise required for. For example,
supposing your formfield names are 'Text1' to 'Text7', you could use
something like:

Sub CalcDates()
Dim iDate As Date
Dim i As Integer
With ActiveDocument
If IsDate(.FormFields("Text1").Result) Then
iDate = CDate(.FormFields("Text1").Result)
For i = 2 To 7
iDate = CDate(iDate + 1)
.FormFields("Text" & i).Result = iDate
Next
Else
MsgBox ("Enter a valid date.")
End If
End With
End Sub

Cheers

--
macropod
[MVP - Microsoft Word]


"ChrisM" wrote in message
...
MSWord 2000, XP Professional

Hi,

I have a document that is basically a form with a section for each day of
the week.
Currently, every week I have to change all seven dates before printing the
document. What I would like is to be able to enter the first date and have
all the rest calculated automatically.
I have got as far as a single Form Field to enter the first date. I'm now
trying to insert Formula fields for the rest.
The FirstDate (Form Field) is defined as type 'Date', is set to 'Calculate
on Exit' and has a name in the BookMark field setting ('MyDate')
The first Formula Field looks somthing like {=MyDate+1 \@"dd/MM/yy}.
I then set document protection to 'Forms'
When I enter a date in the FormField, the formula field changes to TODAYS
date, regardless of the FormField date. Anyone help me out here?

Note: It has to be a entered date, and not based on the current date, as

it
can vary when this form is required, and the start date is not usually
todays date, or a fixed deviation from it.

Cheers,

ChrisM.




  #3   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor
 
Posts: n/a
Default Displaying consecutive Dates On A Form

If only it was that simple - see
http://www.gmayor.com/insert_a_date_...than_today.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ChrisM wrote:
MSWord 2000, XP Professional

Hi,

I have a document that is basically a form with a section for each
day of the week.
Currently, every week I have to change all seven dates before
printing the document. What I would like is to be able to enter the
first date and have all the rest calculated automatically.
I have got as far as a single Form Field to enter the first date. I'm
now trying to insert Formula fields for the rest.
The FirstDate (Form Field) is defined as type 'Date', is set to
'Calculate on Exit' and has a name in the BookMark field setting
('MyDate') The first Formula Field looks somthing like {=MyDate+1
\@"dd/MM/yy}.
I then set document protection to 'Forms'
When I enter a date in the FormField, the formula field changes to
TODAYS date, regardless of the FormField date. Anyone help me out
here?
Note: It has to be a entered date, and not based on the current date,
as it can vary when this form is required, and the start date is not
usually todays date, or a fixed deviation from it.

Cheers,

ChrisM.



  #4   Report Post  
Posted to microsoft.public.word.newusers
ChrisM
 
Posts: n/a
Default Displaying consecutive Dates On A Form

Thanks for your replays.
How crazy is that calculation...??!

Will go to plan B(as suggested) and write a little VBA macro.
.... or maybe just stick to filling the dates in by hand!! :-(

Thanks again,

ChrisM


  #5   Report Post  
Posted to microsoft.public.word.newusers
Graham Mayor
 
Posts: n/a
Default Displaying consecutive Dates On A Form

Just copy the field code from macropod's document and change the final
switch and the delay.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ChrisM wrote:
Thanks for your replays.
How crazy is that calculation...??!

Will go to plan B(as suggested) and write a little VBA macro.
... or maybe just stick to filling the dates in by hand!! :-(

Thanks again,

ChrisM





  #6   Report Post  
Posted to microsoft.public.word.newusers
macropod
 
Posts: n/a
Default Displaying consecutive Dates On A Form

Or maybe even use the code in supplied in my previous post in this thread
....

Cheers

--
macropod
[MVP - Microsoft Word]


"Graham Mayor" wrote in message
...
Just copy the field code from macropod's document and change the final
switch and the delay.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ChrisM wrote:
Thanks for your replays.
How crazy is that calculation...??!

Will go to plan B(as suggested) and write a little VBA macro.
... or maybe just stick to filling the dates in by hand!! :-(

Thanks again,

ChrisM





  #7   Report Post  
Posted to microsoft.public.word.newusers
ChrisM
 
Posts: n/a
Default Displaying consecutive Dates On A Form


"Graham Mayor" wrote in message
...
Just copy the field code from macropod's document and change the final
switch and the delay.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ChrisM wrote:
Thanks for your replays.
How crazy is that calculation...??!

Will go to plan B(as suggested) and write a little VBA macro.
... or maybe just stick to filling the dates in by hand!! :-(

Thanks again,

ChrisM






"macropod" wrote in message
...
Or maybe even use the code in supplied in my previous post in this thread
...


My specific example was slightly more complicated than how I explained it. I
was just after a basic technique. However, I have written a little macro now
(based on your code, thanks) and all is good...
Only problem now is that the guy who will be using it has 'high security'
set on his PC, and it won't run Word macros. Have to try and convince him
that he won't become infested with viruses if he enables them.
Cheers,
ChrisM.




  #8   Report Post  
Posted to microsoft.public.word.newusers
macropod
 
Posts: n/a
Default Displaying consecutive Dates On A Form

Hi Chris,

In that case, you still have the field code version as a last resort - macro
settings don't apply to fields!

Cheers

--
macropod
[MVP - Microsoft Word]


"ChrisM" wrote in message
...

"Graham Mayor" wrote in message
...
Just copy the field code from macropod's document and change the final
switch and the delay.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ChrisM wrote:
Thanks for your replays.
How crazy is that calculation...??!

Will go to plan B(as suggested) and write a little VBA macro.
... or maybe just stick to filling the dates in by hand!! :-(

Thanks again,

ChrisM





"macropod" wrote in message
...
Or maybe even use the code in supplied in my previous post in this

thread
...


My specific example was slightly more complicated than how I explained it.

I
was just after a basic technique. However, I have written a little macro

now
(based on your code, thanks) and all is good...
Only problem now is that the guy who will be using it has 'high security'
set on his PC, and it won't run Word macros. Have to try and convince him
that he won't become infested with viruses if he enables them.
Cheers,
ChrisM.






  #9   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP
 
Posts: n/a
Default Displaying consecutive Dates On A Form

Create the form as a template and have him save it in his templates folder.
Then it will be considered as trusted and will not given an macro warning
when he creates a new document from it by selecting New from the File menu
and selecting the template.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"ChrisM" wrote in message
...

"Graham Mayor" wrote in message
...
Just copy the field code from macropod's document and change the final
switch and the delay.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


ChrisM wrote:
Thanks for your replays.
How crazy is that calculation...??!

Will go to plan B(as suggested) and write a little VBA macro.
... or maybe just stick to filling the dates in by hand!! :-(

Thanks again,

ChrisM





"macropod" wrote in message
...
Or maybe even use the code in supplied in my previous post in this thread
...


My specific example was slightly more complicated than how I explained it.
I was just after a basic technique. However, I have written a little macro
now (based on your code, thanks) and all is good...
Only problem now is that the guy who will be using it has 'high security'
set on his PC, and it won't run Word macros. Have to try and convince him
that he won't become infested with viruses if he enables them.
Cheers,
ChrisM.






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
displaying the user form data cyzax7 via OfficeKB.com Mailmerge 1 June 9th 06 08:46 PM
Merge Excel data into specific form areas in a Word Doc duugg Microsoft Word Help 1 May 4th 06 10:27 AM
how to keep a locked form from displaying markups on opening. cmejia Microsoft Word Help 1 April 27th 06 02:32 PM
Word doc/protected form and formatting dates ACQ Microsoft Word Help 2 January 27th 06 05:39 PM
Enter data in 1 text form field & have multiple locations fill Lee Microsoft Word Help 1 March 16th 05 10:56 PM


All times are GMT +1. The time now is 06:54 AM.

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"