Wrox Programmer Forums
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 18th, 2004, 09:08 AM
Registered User
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Default Values

I want to set a date and time stamp so I set up a field in the table and fill in the Default Value as =Now() (I have tried just Now()) on a text field (I have tried a Date field). I then save the change close and reopen the table add a new record.....no date and time & stamp, I then check the design and no default set!

I have tried to be as methodical as possible but must be doing something stupid but I can't see what.

Can anybody help?

If you can help on this please look at my posting of last week.

Old October 18th, 2004, 11:25 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts


   Try designing a quick table, put in an autonumber PK, a text field, and use the following for your date field:
Field Name: DateTime
Data Type: Date/Time
Default Value: =Now()

   Save and open the table. The Date/Time should automatically populate the DateTime field.

   If you are opening the table in a form, and the DateTime field is not on the form, try putting it on the form and setting visible to No or False for that field. Make sure it is high in the tab order for good measure.

Does this help?

Old October 19th, 2004, 05:57 AM
Registered User
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks MMcDonal that is exactly what I did just after I posted my query. Guess what.....it worked, it was then that I noticed something about Now() in a default. The Now() is set in the next record so that when it is created it shows the time of the last creation (now I concede that I may be doing something really stupid but try it and see if I'm right). I have decided to write a VBScript which I'll attach to the new record button on the toolbar in a DAP.

Any takers for my posting of last week which poses me a greater problem (If I can't solve it I will be migrating my work to PHP/MySQL)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Field Values tachtenberg Reporting Services 1 February 19th, 2008 05:52 PM
Default Values On Fields hossrad SQL Server 2005 2 May 15th, 2007 02:27 AM
setting default values prithvi28 XSLT 1 October 3rd, 2006 01:38 PM
Default Values for Query Odifius Access VBA 3 September 20th, 2006 06:30 AM
Default values? Raymie_C Access VBA 2 May 16th, 2005 11:48 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.