Access 2007 Add notation to memo field in multiple records (1 Viewer)

Grover

New member
Local time
Today, 03:02
Joined
Dec 29, 2012
Messages
2
What I'd like to be able to do is filter by form in a contact database and simply add a carriage return, timestamp and comment to the top of a memo field for each of the records selected.

I've tried a simple search-and-replace as well as a simple update query but in both cases the carriage return/line feed codes are placed literally rather than causing an actual carriage return.

The other problem with this approach is that there may be times when I don't have anything to search for and therefore replace in the memo field.

I'm guessing VBA is the right way to go. I have no idea how to code something like that. I'm sure this question has come up numerous times but can't really find the answer in part I suppose because I am using the wrong search criteria since I don't really have the lingo down either.

:confused: Can anyone post a link that would get me started on this? Or a surefire search phrase? Thanks.
 

John Big Booty

AWF VIP
Local time
Today, 20:02
Joined
Aug 29, 2005
Messages
8,263
Welcome to the forum.

The following code should do what you want;

Code:
While Me.NewRecord = False
     Me.YourNoteField = Chr(13) & Chr(10) & Now() & "Your Comment Here" & Me.YourNoteField
     DoCmd.GoToRecord acDataForm, "YourFormName", acNext
Wend
This will add a carriage return followed by the time/date stamp, your comment to the note in the current record and all subsequent records, in the form.
 
Last edited:

Grover

New member
Local time
Today, 03:02
Joined
Dec 29, 2012
Messages
2
SOLVED

That's brilliant John Big Booty: I made a couple of tweaks, adding in a more human-readable date stamp and an input box for versatility then attached it to a button as here:

Code:
Private Sub AppendComment_Click()
Dim InPutComment As String
InPutComment = InputBox("Add Comment")
While Me.NewRecord = False
     Me.YourNoteField = Chr(13) & Chr(10) & Format$(Now(), "Long Date") & ": " & InPutComment & Me.YourNoteField
     DoCmd.GoToRecord acDataForm, "YourFormName", acNext
Wend
End Sub
Thanks so much. :D I've been looking for this solution for a few weeks now. :banghead:
 

Users who are viewing this thread

Top Bottom