Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set the DefaultValue to the system date() for an Access Table

Status
Not open for further replies.

VANMAN

MIS
Sep 10, 1999
26
0
0
CA
I am updating several hundred customers with some new tables for thier Access Database. I have created a table from SQL code and I am trying to set the tabledef Field.DEFAULTVALUE to the system date. Using the DATE() function.

I am using the tabledef object and this code works for everything but the date. The following code sets the date to the current date, a set value. I want it to set the date on each new record to the system date. Any help would be appreciated.

If fld.Name = "UpdatedOn" Then

fld.DefaultValue = Date()

End If
 

Have you tried setting the default value using a literal string rather than the value of Date()?

fld.DefaultValue = "Date()" Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Thanks, this works great. I thought I has already tested this but I must have missed it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top