How to Insert a Date into a Memo Field

ID: Q130405

The information in this article applies to:

SUMMARY

This article shows by example how to insert the current date into a memo field.

MORE INFORMATION

Step-by-Step Example

1. Create or use a database that contains a memo field.

2. Create a test screen, and include the memo field.

3. In the screen layout code, give the screen a name such as Test.

4. In the setup code of the screen, type this code:

   ON KEY LABEL F12 DO INS.PRG
   SCATTER MEMVAR MEMO

   NOTE: You can choose the function key and Program name.

5. In the WHEN clause of the memo field add the following, replacing <memo
   field name> with the name of your memo field:

   MODIFY MEMO <memo field name>

6. Create a program named INS.PRG that contains the following code:

   SET REFRESH TO 1
   =INSMODE(.T.)
   KEYBOARD DTOC(DATE())
   SHOW WINDOW test REFRESH SAME
   SET REFRESH TO 0

Any time the screen is run and the F12 key is pressed the program executes and the system date is inserted into the memo field.

Additional reference words: FoxWin 2.60a KBCategory: kbprg kbcode KBSubcategory: FxprgGeneral

Last Reviewed: July 5, 1995