Add date record created to existing records (1 Viewer)

elbowman

Registered User.
Local time
Today, 03:55
Joined
Nov 10, 2011
Messages
27
Does Access programmatically add a date created to a database record, even if the dumb db developer didn't add a date created field to the form initially?

Is there a way to pull that date stamp into the existing database records? :confused:
 

spikepl

Eledittingent Beliped
Local time
Today, 12:55
Joined
Nov 3, 2010
Messages
6,142
Access is not smart enough to cater for all kinds of dumb db developers.

So whatever is not in the record, it's not in the record. If that field is not in the record, it's not there. If it's in the record, and set to Date/Now as default in the table design, then it's there.
 

elbowman

Registered User.
Local time
Today, 03:55
Joined
Nov 10, 2011
Messages
27
That's what I was afraid of, Spike! Thanks!
 

missinglinq

AWF VIP
Local time
Today, 06:55
Joined
Jun 20, 2003
Messages
6,420
You can, of course, add a Date or DateTime stamp to your Table that will document the creation date for any future records you create.

You can do it, as Spike suggested, by setting the Default for the Field, at Table level, to Date() to record only the date, or Now() to record date and time.

To do the same thing at the Form level, if you have a Textbox to display it on your Form, would do something like
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
 If Me.NewRecord Then
  Me.CreationDate = [B]Date[/B]
 End If
End Sub
For date and time, replace Date with Now.

Linq ;0)>
 

elbowman

Registered User.
Local time
Today, 03:55
Joined
Nov 10, 2011
Messages
27
Thanks for the kind assistance.

I had figured out how to add the field going forward.

I was just hoping there was something to save me from myself in the application.

Lance
 

vbaInet

AWF VIP
Local time
Today, 11:55
Joined
Jan 22, 2010
Messages
26,374
Putting =Now() in the Default Value property of the date field in the table will do to.
 

missinglinq

AWF VIP
Local time
Today, 06:55
Joined
Jun 20, 2003
Messages
6,420
Yes, but sadly for Lance, nothing will work retroactively! :(

Where is H.G. Wells when you need really him? :D
 

Users who are viewing this thread

Top Bottom