PC Review


Reply
Thread Tools Rate Thread

Default to Today's date in a form

 
 
Andy
Guest
Posts: n/a
 
      19th Jun 2008
I want a date field of a Word 2003 form to default to today's date. I put in
{DATE} in the default date property but I get "A valid date or time is
required". Is there a way to do this? Thanks.

Andy
 
Reply With Quote
 
 
 
 
Graham Mayor
Guest
Posts: n/a
 
      20th Jun 2008
Either put a DATE field or a CREATEDATE field in the template where you want
the date to appear, or if you want today's date in a Date formfield, set the
formfield type to 'Current Date'. If you want to start with Today's date,
and allow the user to change that date to some other date, you will need
instead an on-entry macro to fill the date eg assuming the text field is
bookmarked "Date1", the following will insert the current
date in that field when you tab into it, in the format of the switch - here
"dd\MM\yyyy"


Sub SetDate()
Dim sDate As Date
sDate = Format((Now), "dd/MM/yyyy")
ActiveDocument.FormFields("Date1").Result = sDate
End Sub

http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

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


Andy wrote:
> I want a date field of a Word 2003 form to default to today's date.
> I put in {DATE} in the default date property but I get "A valid date
> or time is required". Is there a way to do this? Thanks.
>
> Andy



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enter a Default date of Today in a text Form Field Pawprint Microsoft Word Document Management 4 3rd Oct 2008 07:04 AM
New tasks get a due date of today. How to default to no due date? =?Utf-8?B?QW5kcmV3IExheW1hbg==?= Microsoft Outlook Discussion 0 9th May 2007 09:31 PM
Today's date to default in form text box =?Utf-8?B?VHk=?= Microsoft Access Forms 1 6th Dec 2004 10:24 PM
open a form at today's date or next date if no match for today Rod Isaacs, St George Hospital Microsoft Access Form Coding 1 7th Jan 2004 08:36 AM
Default Date of Today in Form Field Mark Leffler Microsoft Word New Users 1 13th Oct 2003 07:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:44 AM.