Prev: auto populate time 'time out' field when user comes into a record the second time.
Next: Acc2007: code to print to pdf
From: Marshall Barton on 29 Jun 2010 01:17 David wrote: >Hi, I am trying to have a 'time out' field auto populate when the user >comes into the record the second time. The first time when the user >creates the record, the 'time in' field is auto populated by the code: >Format(Time(),"Medium Time") in the table's default value. The user >opens the record the second time through a form. I have tried to use >the above code in the empty 'time out' textbox's default value, but >nothing happens. I have also tried 'if' statements in the 'on open >Event Procedure', but have not been successful yet. The DefaultValue property is only applied at the time of the first character is entered in a NEW record. SInce the record obviously exist the second time, this property is useless for your purpose. The Open event is to soon to set a control's value, so that won't work either. OTOH, if the form is opened filtered to only the correct record (this is essential), without having to navigate to it, you can use the Load event procedure to set the time out field's value: Me.[time out] = Time() BTW, your DefaultValue expression can simply use: Time() -- Marsh |