Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Timestamp to Memo

Status
Not open for further replies.

taysys

Programmer
Dec 7, 2001
41
0
0
US
Using VFP 7, Codemine 7.1

I have been wrestling with adding a time stamp to a memo field. The memo field is displayed in the ole Rich Text control. I want to have the user click a button to add a date/time stamp to the beginning of the memo field moving the rest of the text down a line.

Any suggestions is greatly appreciated!

Bob Taylor
 
lcText = "Hello World"
? TRANSFORM(DATETIME()) +CHR(13)+CHR(10)+ lcText


It makes datetime a character and adds carriage return (13) & linefeed (10)


Jim Osieczonek
Delta Business Group, LLC
 
Thanks for the quick reply.

Yes this works, as I have been there. But the problem is working woith the RTF control. When I do this, I get all the embedded RTF commands in the display. See below....

10/17/2003 10:57:09 AM
{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\lang1033\b\fs18
\par }

Bob Taylor
 
taysys

I am not familiar with the RTF control, but I suspect the date/time stamp info is going to need to go in somewhere in the RTF format codes:

{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\cf1\lang1033\b\fs18
\par }


What is the name of the field or data in this that you are displaying? That will be helpful.

For example, is the fs18 a fieldname?

Jim Osieczonek
Delta Business Group, LLC
 
Jim,

You clued me into it... part of my string had to have the RTF commands. So I just created a dummy memo, copied the before and after codes along with the transform for the date and voila. See solution below:

lcText1 = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}}" + ;
"{\colortbl ;\red255\green0\blue0;}" + ;
"\viewkind4\uc1\pard\cf1\lang1033\b\fs18 "

lcText2 = "\par \cf0\b0 \par }"

lcConcat = lcText1 + TRANSFORM(DATETIME()) + lcText2 + CHR(13)+CHR(10) + Mednotes.Notes

replace Mednotes.Notes WITH lcConcat

Thanks...!!!

Bob Taylor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top