VBA Code for vbCrLF for Memo RTF Field

OlcayM

Registered User.
Local time
Today, 03:10
Joined
Oct 30, 2007
Messages
47
SOLVED:VBA Code for vbCrLF for Memo RTF Field

I have a wierd problem.
Version: MS Access 2010.
1) A memo field with RTF enabled and Enter key behaviour as new line. Name: MemoField1
2) I have a button to add a new date to the beginning of MemoField1. Name: AddDateButton
Code;
Me("MemoField1").SetFocus
Me("MemoField1") = Format(Now(), "dd/mm/yy hh:nn") & " : " & vbNewLine & Me("MemoField1")

(I used vbCrLf and Chr(13) & chr(10) instead of vbNewLine and they also does not work)

3) So far so good. When I come to a record (an old record I mean) for the first time and click "AddDateButton" it works fine. But if I need to click "AddDateButton" a second time then it does not use vbNewLine and the new date is inserted the same line before.(Please note that SetFocus, Saverecord and other possibilities are all tried)
4) If I go to the MemoField1 and make any kind of edit and click again "AddDateButton" then it works as it should and puts the date to the first line and vbNewLine works.

Any help?

TIA
Olcay:eek:
 
Last edited:
Well, I found a solution on net.

Just put "<br> instead of vbCrLf and voila.

Sorry and Thanks...:)
 

Users who are viewing this thread

Back
Top Bottom