Inserting Today's Date as the Default in "Fillin" form (1 Viewer)

Ally

Registered User.
Local time
Today, 08:14
Joined
Sep 18, 2001
Messages
617
Hi

Been doing a form for the first time properly and am trying to get the default date be today.

Have tried a couple of ways:
1) with using Ctrl + F9, Insert Field, Mail Merge and Fill-in. Then I try entering =Today, =Date, {date} and anything else that I know might possibly work!
2) The other way is clicking the ab option on the forms toolbar, double clicking to get properties, make the type "date" and setting the format, and trying =Today etc in the Default Text.

Neither of them work!

Am I able to do this please!? Be grateful for any hints as not done forms in Word before!

Thank you!

Ally
 

MSAccessRookie

AWF VIP
Local time
Today, 03:14
Joined
May 2, 2008
Messages
3,428
Hi

Been doing a form for the first time properly and am trying to get the default date be today.

Have tried a couple of ways:
1) with using Ctrl + F9, Insert Field, Mail Merge and Fill-in. Then I try entering =Today, =Date, {date} and anything else that I know might possibly work!
2) The other way is clicking the ab option on the forms toolbar, double clicking to get properties, make the type "date" and setting the format, and trying =Today etc in the Default Text.

Neither of them work!

Am I able to do this please!? Be grateful for any hints as not done forms in Word before!

Thank you!

Ally

Today(), Date(), and Now() are all data type functions and they require the "()" in order to be recognized as such. Since your examples did not contain "()", I assume that might be something for you try.
 

Ally

Registered User.
Local time
Today, 08:14
Joined
Sep 18, 2001
Messages
617
Hi - no I did enter the () - just omitted them from my message.

I got the error message "a valid date or time is required" on the Text form field options and on the Fillin one, it reads it as text.
 

wiklendt

i recommend chocolate
Local time
Today, 17:14
Joined
Mar 10, 2008
Messages
1,746
please don't omit things in the messages. these details are crucial for use to trouble shoot with you.
 

Ally

Registered User.
Local time
Today, 08:14
Joined
Sep 18, 2001
Messages
617
please don't omit things in the messages. these details are crucial for use to trouble shoot with you.


I am sorry. I entered in text partially in haste, partially assuming that people would realise that I had included the () in my code.
 

wiklendt

i recommend chocolate
Local time
Today, 17:14
Joined
Mar 10, 2008
Messages
1,746
i understand the haste part. i do it myself. but as for us assuming you included "()" - you must understand that on these fora there are a plethora of VBA virgins asking for help, and you'd be amazed at what they attempt! (i was one of them.... scratch that, i'm STILL one of them!) LOL

as for your specific problem: you can make the default today in your table (and it will flow on to your form, making sure to add the control AFTER you change your table).

in your table design, select the field you want. make sure the type is "date/time", then, in its default property, type

Code:
=Now()
this will insert the date and time of the record creation. to check that it's working, just view your table in normal view and the very bottom record (the one that has a primary key as "(New)") ought to have the correct date and time in its field, which is made more permanent once the record is actually created.

if you want only the date or only the time, like suggested, use

Code:
=Date()
or
Code:
=time()

see the attachments for how this works.

when you then add these fields to yoru form, they will be automatically filled for you.

please tell us what you are doing differently that it's not working for you.
 

Attachments

  • date setup.jpg
    date setup.jpg
    42.9 KB · Views: 1,148
  • date table.jpg
    date table.jpg
    42.8 KB · Views: 687

Ally

Registered User.
Local time
Today, 08:14
Joined
Sep 18, 2001
Messages
617
Hi

In searching for some help on date in Forms in Word again I came across this old post and realised that I'd never responded to the last post - I am sorry, I realise how rude this may appear. I can't remember what I did in the end.

I also realise that you may no longer be on here, but just in case I thought I'd post.

The suggestions you gave (with the images) were from what I could tell, in Access and not Word. I may have to start a new post anyway but thought I would add what I was trying to do.

I've attached a couple of screen shots. In the first one FormProp, this is the properties of the text box for the date of birth. If I put Date() in the default field I get, "A valid date or time is required" error message.

I'm now trying to do a similar thing, but making the age field fill out automatically upon exit from date of birth field, by subtracting Date of birth from Date().
Code:
=date()-txtDoB

But because it won't even accept Date() this won't work either!

Thank you for your previous input and hope you may be able to help!

Ally
 

Attachments

  • FormProp.JPG
    FormProp.JPG
    22.6 KB · Views: 445
  • FormScrShot.JPG
    FormScrShot.JPG
    16.1 KB · Views: 412

wiklendt

i recommend chocolate
Local time
Today, 17:14
Joined
Mar 10, 2008
Messages
1,746
The suggestions you gave (with the images) were from what I could tell, in Access and not Word. I may have to start a new post anyway but thought I would add what I was trying to do.

But because it won't even accept Date() this won't work either!

Sorry, my bad - i often forget to check where the thread is in the forum (Word, Excel, VBA.....) and often default my perspective to Access.

What version of word are you using?

In 2010, you can insert an autoupdating date filed by clicking the insert ribbon, date and time, select a format, check the 'auto update' checkbox, and hit ok. when i then toggle the field code (using right click on the field), i see:
Code:
{ DATE \@ "dd/MM/yyyy" }

see the image below - it should be similar for previous version. Note that i've never used VBA or even forms from within Word, so i've no idea if this will integrate. let us know your progress. hopefully this will give you some ideas anyway.

 

Attachments

  • WORD - Insert date field.png
    WORD - Insert date field.png
    49.6 KB · Views: 10,064

Ally

Registered User.
Local time
Today, 08:14
Joined
Sep 18, 2001
Messages
617
Hi Agnieszka

Thanks for responding! I'm on Word 2003.

You can insert a field for date with 2003, but I'm not sure if this can be incorporated into the Form fields. The form fields now has an option for Current Date, but trying to use Date() in a calculation, still doesn't work. I'll keep trying!
 

wiklendt

i recommend chocolate
Local time
Today, 17:14
Joined
Mar 10, 2008
Messages
1,746
Hi Agnieszka

Thanks for responding! I'm on Word 2003.

You can insert a field for date with 2003, but I'm not sure if this can be incorporated into the Form fields. The form fields now has an option for Current Date, but trying to use Date() in a calculation, still doesn't work. I'll keep trying!

are you able to view the field code int he form fields? (try right-click, edit (or view?) field codes...), and see what it has there. maybe you can refer to the field itself rather than the forumla (ie., instead of calculating current date, use a formula to say fldDate - fldDOB)

sorry i can't be much help, i've not used forms in word. could you post the form for us to play with it see if we can get it working for you?
 

RayH

Registered User.
Local time
Today, 00:14
Joined
Jun 24, 2003
Messages
132
Is it this you are after?
Click on the 'ab' to create the field, then right click on it, Properties. Choose Current Date in the Type field.
See attachment.
 

Attachments

  • Form Current Date.jpg
    Form Current Date.jpg
    45.8 KB · Views: 615

Ally

Registered User.
Local time
Today, 08:14
Joined
Sep 18, 2001
Messages
617
You can insert a field for date with 2003, but I'm not sure if this can be incorporated into the Form fields. The form fields now has an option for Current Date, but trying to use Date() in a calculation, still doesn't work. I'll keep trying!

Hi Ray

What I'm trying to do is put a calculation using the current date. Basically I have a Date of Birth field and an age field. Rather than fill out the age field, I would rather it do:
Code:
(Today()-DateOfBirth)/365.25
(like you would do in Excel, or a DateDiff in Access), to give the age.

I've attached a cut down version of the form with the relevant fields.

Thanks

Ally
 

Attachments

  • tmpSrokeInEvolutionTIAReferralForm.doc
    49.5 KB · Views: 314

Users who are viewing this thread

Top Bottom