"cengel0327" <(E-Mail Removed)> wrote in message
news:A1737ED9-5A9F-416D-8269-(E-Mail Removed)
> Within my Form I have a subform in datasheet view that only has two
> fields Date/Time and Comments/Status. I'd like to auto insert the
> current date & time in the sub-form when someones adds an entry to
> the comments/status field.
>
> I've set the default value to now() in the sub-form (design view),
> however, it automatically inserts the date and time for the next row
> instead of keeping with the row where I type in new data.
>
> Please help. Thanks.
So the user is editing an existing record, and you want to save the
date/time of that edit in the [Date/Time] field of that record? For
that, you'll have to use the form's BeforeUpdate event. An event
procedure might look like this:
'----- start of example code -----
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me![Date/Time] = Now()
End Sub
'----- end of example code -----
You should be aware that field names containing the "/" character are
not a very good idea, as they force you to enclose the field name in
brackets ([]) every time you use it.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)