Writing a timestamp to a file?

E

everymn

Is there not a simple way to do this? The help page for the time date
functions say that they are to be used in calculated controls in
forms. If I set a control in a form to something like =date(), how do
I then get it stored to the table that the form is based on? I'm sure
I could do it in code but it seems like there should be a simpler way
to do it.

Thank You
 
J

Joan Wild

When and what do you want stored? The date and time, just the date? Also
just when a record is first created; or whenever it's modified?

If you just want the date stored when a new record is created, then you'll
need a field in your table to store the value. On a form, you'd set the
default value property for a textbox bound to this field to
=Date()
=Now()
(that'll get you date and time)

That will work for new records. If you want this captured for when there
are changes to existing records, you'd need to write code.

Post back with specifics, if the above doesn't help
 
R

ruralguy via AccessMonster.com

You need to put code in the BeforeUpdate event of the form.

[YourTimeStampField] = Now()
...using your time stamp field of course.

This will include the time and only stamp the record when some other field
has been modified.
 
E

everymn

On Mon, 4 Dec 2006 14:05:49 -0500, "Joan Wild"

Both, and both. I doing some compatibility testing and need to test
all permutations. This gets me going though thanks
 
J

Joan Wild

Well, I got you started for when the record was created. You can add
another field to store when it was modified.

In your forms (and assuming all data interaction is via forms), you'd use
the BeforeUpdate event for the form to push =Now() into this field.

Me![ModifiedOn] = Now()
Change ModifiedOn to the name of the control bound to your modified field.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top