Date Function in Macro returns 12:00:10 AM (1 Viewer)

ajarrell

Registered User.
Local time
Today, 17:52
Joined
Feb 4, 2014
Messages
52
In Access, I Created a Macro with:

Condition: [Forms]![frmContacts]![NewRecord]=True
Action: SetValue
Arguments: [Forms]![frmContacts]![RecAdded],=Date()


The Condition part seems to work as desired, but when it is true, the field [RecAdded] is set to "12:00:10 AM".

I want to record the date a new record was added to the database, and would very much appreciate help in getting this problem resolved.
 

spikepl

Eledittingent Beliped
Local time
Today, 23:52
Joined
Nov 3, 2010
Messages
6,142
Your predicament does not jibe with anything.

There is no way that assigning the value of Date() performed as shown here would give you the result you show. Another assignment must have been done elsewhere (than in this macro).

In the table design, set the default value of the field to Date()
 
Last edited:

ajarrell

Registered User.
Local time
Today, 17:52
Joined
Feb 4, 2014
Messages
52
Now, my macro is returning 12:01:26 AM. I am attaching a db file with a form, frmContacts. Entering a new record will demonstrate the problem. I am hopeful that someone can help. Thank you in advance!
 

Attachments

  • Test.accdb
    552 KB · Views: 106

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:52
Joined
May 7, 2009
Messages
19,242
edit your macro remove the first line ("If ...[newrecord)
activate this macro in the Before Insert on your form.
 

ajarrell

Registered User.
Local time
Today, 17:52
Joined
Feb 4, 2014
Messages
52
Setting the default value was exactly what I needed. I didn't know that property existed. Thank you!
 

Users who are viewing this thread

Top Bottom