Log in

View Full Version : Solved: Trouble with Now() function



Eric58132
09-01-2009, 08:36 AM
Goood morning,

This one caught me by surprise, hopefully someone has a quick fix.

I maintain a database that creates an "action log" that tracks the amount of time a person spends editing a record. Every time a new record is brought to the screen, a text box that is bound to Now() updates. When the "Save" button is hit, a second Now() is calculated and both times are recorded in a table, along with misc. account information.

My problem is this: When the record is edited, but the "Save" button has not yet been hit, the first Now() value is updating because the table the dataset lies in is bound. Is there a way to make this Now() value only update when, for example, a different text box changes value? I could then select one that would never be changed until the next record is selected (after "Save").


Thanks!

geekgirlau
09-02-2009, 10:25 PM
Use an unbound control instead, and change the value to Now() when an event occurs. For example, you might use the "On Dirty" event on the form to set the value of the text box to Now(), then use the "After Update" event as the trigger to calculate the duration.

Eric58132
09-03-2009, 07:42 AM
thanks geekgirl, this works perfectly. I ended up putting it in the 'current' event space, so it only updates when there is a full record switch.