Delaying date & time stamp in a long form

R

ronben

Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I have a form with several pages. Each page is used for part of an interview. When I start using Page 1, a form field automatically fills with current date and on all subsequent pages, the field fills with the same current date. But I want each page to fill with the current date/time when the interview actually reaches that page and not with the date/time when the interview began. For example, I might not get to Page 4 of the interview until some 30 minutes have gone by.
Does this call for a macro to run upon tabbing to that field to insert current/date and time?

Thanks.
 
J

John McGhie

Hi Ron:

Yes, it would require a macro, but it would be worse than that: Word
retrieves the date from the operating system, but it only asks "once" at
Application Launch.

People who never restart Word find the date never changes :)

You would need to write a macro that shells out to the OS and queries the
system time to get the current date :)

Cheers


Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I have
a form with several pages. Each page is used for part of an interview. When
I start using Page 1, a form field automatically fills with current date and
on all subsequent pages, the field fills with the same current date. But I
want each page to fill with the current date/time when the interview actually
reaches that page and not with the date/time when the interview began. For
example, I might not get to Page 4 of the interview until some 30 minutes have
gone by.
Does this call for a macro to run upon tabbing to that field to insert
current/date and time?

Thanks.

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 
R

ronben

Wow... and I am quite rusty with UNIX... I will mull that over and try to get into it after I get back from the boat show (Yep, its 15 deg F and snow on the ground but I am going to Strictly Sail to look at boats and dream-on about summer.

Ron
 
J

John McGhie

Hey, Summer is OK, let me tell you... It's 28 degrees C out there at 8.00 pm
as I write, nice and warm...


Wow... and I am quite rusty with UNIX... I will mull that over and try to get
into it after I get back from the boat show (Yep, its 15 deg F and snow on the
ground but I am going to Strictly Sail to look at boats and dream-on about
summer.

Ron

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 
P

Peter Jamieson

FWIW if I open a new document in Word 2004, enter a { DATE } field and
update it, then let the date roll over to a new day, it does change.
Also, if I re-execute a VBA Sub such as

Sub dt()
debug.print date
debug.print time()
End Sub

it also rolls over correctly.

That's on Word 2004 11.5.6 on Snow Leopard 10.6.2.

So I would guess at least something may have been fixed at some point on
this front. I'd also be interested to know whether Word VBA gets the
date time from the OS regardless of what Word itself does.

If VBA gets the right date and time then what I would probably try is
a. create a Word variable for each page of the form (e.g. called
"p1datim", "p2datim" or some such
b. insert the corresponding { DOCVARIABLE } field ( { DOCVARIABLE
p1datim } etc.) on each page of the form
c. use the enter/exit form field procedures to update the value of the
Variable and update the field (may not be particularly straightforward
either).

Haven't tried it though.

Peter Jamieson

http://tips.pjmsn.me.uk
 
P

Peter Jamieson

FWIW if I open a new document in Word 2004, enter a { DATE } field and
update it, then let the date roll over to a new day, it does change.
Also, if I re-execute a VBA Sub such as

Sub dt()
debug.print date
debug.print time()
End Sub

it also rolls over correctly.

That's on Word 2004 11.5.6 on Snow Leopard 10.6.2.

So I would guess at least something may have been fixed at some point on
this front. I'd also be interested to know whether Word VBA gets the
date time from the OS regardless of what Word itself does.

If VBA gets the right date and time then what I would probably try is
a. create a Word variable for each page of the form (e.g. called
"p1datim", "p2datim" or some such
b. insert the corresponding { DOCVARIABLE } field ( { DOCVARIABLE
p1datim } etc.) on each page of the form
c. use the enter/exit form field procedures to update the value of the
Variable and update the field (may not be particularly straightforward
either).

Haven't tried it though.

Peter Jamieson

http://tips.pjmsn.me.uk
 
R

ronben

Thanks for the suggestions; I will try it later. I did try to use the VBA NOW function which seems to roll over but I want to spend more time with it and be sure about it.

Ron
 
J

John McGhie

Please let us know if it works: as far as I knew, they hadn't fixed the
issue. But Peter seems to have found that they have fixed it and I would
like to know that :)


Thanks for the suggestions; I will try it later. I did try to use the VBA NOW
function which seems to roll over but I want to spend more time with it and be
sure about it.

Ron

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 
R

ronben

This seems to work:

dim current as Date
current = Now
activedocument.formfields("CurrDateTime").result=current

...provided the date-time field to be updated on a subsequent page is preceded by another field that runs the macro upon exit and that each field to be updated has its own unique bookmark; e.g., CurrDateTime2, CurrDateTime3, etc.

Ron
 
J

John McGhie

Hi Ron:

Yep, that should indeed work :)

"Now" is actually an aliased System call: the VBA runtime calls out to the
OS to get the current time each time "Now" runs.

So that should be quite stable.

Cheers


This seems to work:

dim current as Date
current = Now
activedocument.formfields("CurrDateTime").result=current

...provided the date-time field to be updated on a subsequent page is preceded
by another field that runs the macro upon exit and that each field to be
updated has its own unique bookmark; e.g., CurrDateTime2, CurrDateTime3, etc.

Ron

This email is my business email -- Please do not email me about forum
matters unless you intend to pay!

--

John McGhie, Microsoft MVP (Word, Mac Word), Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. | Ph: +61 (0)4 1209 1410
+61 4 1209 1410, mailto:[email protected]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top