How to Insert a Date into a Memo Field

Last reviewed: July 5, 1995
Article ID: Q130405
The information in this article applies to:
  • Microsoft FoxPro for Windows, version 2.6a

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 5, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.