Updating a change date

enxio27

Registered User.
Local time
Today, 15:38
Joined
Oct 21, 2006
Messages
14
How do I set up a date field so that it changes to the current date whenever any other field in the record is changed?
 
assuming you are doing it through a bound form, in the before update event of the from (ie the form is saving a change, therefore the data has been edited, set change date to todays date. Have the change date field either as visible, locked or nnot visible and set it by

ie [changedate] = date()
or [changedate] = now() stores the time also.

if you are doing it with a SQL statement, then set the data field at the same time as you store any other changes.

systems often store dates and other info, such as "who did it" to store things like who created the record, who made last change etc.

if you store the [changedate] as a memo field, ie a long text string you could actually keep a history of all changes - just depends how complex you want or need to be.
 
gemma-the-husky said:
assuming you are doing it through a bound form,

I haven't even bothered with setting up forms yet--just the tables. Do I need to set up a form in order to do this?

ie [changedate] = date()
or [changedate] = now() stores the time also.

I have that set up as the default in the table design, but it applies for only new records, not existing records that have been changed. FYI, this field is has a date/time type.

if you are doing it with a SQL statement, then set the [data field at the same time as you store any other changes.

How do I set this SQL statement up in the table design?
 
yes, in your table design you can set a default value for a new record, but once you've created the record, thats that

to modify it you either need to open the table and change the data, or design a form to interface with the data.

HOWEVER

You shouldn't really let your users open the table directly, as they can enter pretty well anything directly into tables, and this might conflict with the "sense" of what the data should contain - therefore you should use forms to process changes to the data, and you are then able to validate the entries on the forms - hence the original reply.
 
gemma-the-husky said:
to modify it you either need to open the table and change the data, or design a form to interface with the data.

So what you're saying is that my two choices are to create a form and use the form to update the change date, or to manually change the date in the table. Is that correct?

You shouldn't really let your users open the table directly

In this case, I'm the only user, so no harm done.
 
gemma-the-husky said:
Have the change date field either as visible, locked or nnot visible and set it by

ie [changedate] = date()

It took me a while, but I finally figured out why I was having trouble getting this to work. I was trying to set the BeforeUpdate property for the [last_update] field rather than for the form itself.

Thanks again for your help!
 
Last edited:
i wouldn't change it directly in the table, ever, unless i needed to do that for some mtce issue.

I presume you are adding or maintaining records via a form. Use the form's before update event to change the datelastedited field
 

Users who are viewing this thread

Back
Top Bottom