View Single Post
  #18  
Old November 27th, 2006, 12:48 AM posted to microsoft.public.access.forms
Tank
external usenet poster
 
Posts: 45
Default Date stamp a notes field

Hi Allan. Well, we’re really raking this one over. Hope you’ll hang in.
Doug’s comments are great and right on target.

I’m a bit concerned with your original feedback to me that you get a syntax
error with the coding I suggested. I’m still puzzled how you would get that
error message, but that’s hopefully not going to happen any more. I think
possibly you might have tried to enter the event procedure into the Notes
field rather than into the unbound control that Fred and I suggested earlier.
Although my original coding works fine in my applications, I will present a
slight modification below using some of Doug’s suggestions, simply to be
consistent with input.

I feel the application using an unbound control to enter the data for the
memo field is the best way to go vs. expecting users to enter directly into
the memo field control and expect the date and time to display right away for
them. The date and time will display, but only after tabbing out of the
field control (AfterUpdate).

So, here is the modification I am suggesting in using the unbound control in
conjunction with the Notes memo field.

FOLLOWING IS FOR AN UNBOUND CONTROL THAT TRANSFERS DATA ENTRY TO A MEMO
FIELD IN DESCENDING ORDER (most recent at top) ADDING A DATE/TIME STAMP:

Me.Notes = vbCrLf & vbCrLf & Now() & vbCrLf _
& Me.CommentUnbound & " " & Me.Notes

Me.CommentUnbound = vbNullString


THIS PRODUCES THE FOLLOWING FORMATTING USING SAMPLE DATA:

11-26-07 4:23 pm.
Friday is coming after Thursday.

11-26-07 4:22 pm.
Thursday will come next. This memo system uses an unbound control
to enter data. When the cursor leaves the unbound control, the information
is transferred to the Memo.

11-26-07 4:20 pm.
Wednesday will come first.

Doug Steele’s example produces the following sample:

26-Nov-06 18:03 The most recent entry displays on top (descending order).
26-Nov-06 18:02 Let's go one more time to show the descending order.
26-Nov-06 18:01 Now we will try this again
26-Nov-06 18:00 I will test Doug Steele's version.

Doug did suggest, “I'd also put a new line between the comment you just added
and the rest of the text in Notes”. My coding above addresses Doug’s advice
by starting off with two line feeds.

Please also keep in mind that your need to use the same control names in
your coding as the names you give the controls. For example, if you place an
unbound control on your form in design view, you will have to name it and use
that name in your event procedure. I sometimes make that mistake and lose
time figuring out why the procedure is not working correctly.
“CommentUnbound”, for example is just a name I suggested. You may have been
working with another name for that control, such as “Text1027” or something
like that.

Sorry for any confusion, and please let us know if this is working for you,
and if not, please provide as much information as you can, even if it means
listing your steps in building this event procedure. That way, we might
discover something that will save us all a lot of time.

- - - -
Tank