Copies the contents of a text file to a memo field.
APPEND MEMO MemoFieldName FROM FileName[OVERWRITE] [AS nCodePage] |
Parameters
- MemoFieldName
- Specifies the name of the memo field to which the file is appended.
- FROM FileName
- Specifies the text file whose contents are copied to the memo field. You must include the entire text file name, including its extension.
- OVERWRITE
- Replaces the current contents of the memo field with the contents of the file.
- AS nCodePage
- Specifies the code page of the text file copied to the memo field. Microsoft Visual FoxPro copies the contents of the text file and, as it copies the data to the memo field, automatically converts the data from the code page you specify to the code page of the table containing the memo field. If the table containing the memo field is not marked with a code page, Visual FoxPro automatically converts the data from the code page you specify to the current Visual FoxPro code page. If you specify a value for nCodePage that is not supported, Visual FoxPro generates an error message. You can use GETCP(В ) for nCodePage to display the Code Page dialog box, allowing you to specify a code page for the appended table or file. If you omit the AS nCodePage clause or specify 0 for nCodePage, no code page conversion occurs for the text file.
Remarks
The entire text file is appended to the contents of the specified memo field in the current record if overwrite is omitted.
Example
In the following example, the contents of the memo field notes
are copied to a file called Test.txt. Test.txt is then appended to the contents of the memo field. Finally, the contents of Test.txt replace the current contents of the memo field.
В | Copy Code |
---|---|
CLOSE DATABASES OPEN DATABASE (HOME(2) + 'Data\testdata') USE employee && Open Employee table WAIT WINDOW 'Employee notes memo field - press ESC' NOWAIT MODIFY MEMO notes NOEDIT && Open the notes memo field COPY MEMO notes TO test.txt && Create test file from memo field WAIT WINDOW 'TEST.TXT text file - press ESC' NOWAIT MODIFY FILE test.txt NOEDIT && Open the text file WAIT WINDOW 'Employee notes now appended - press ESC' NOWAIT APPEND MEMO notes FROM test.txt && Add contents of text file MODIFY MEMO notes NOEDIT && Display memo field again WAIT WINDOW 'Overwrite Employee notes- press ESC' NOWAIT APPEND MEMO notes FROM test.txt OVERWRITE && Replace notes MODIFY MEMO notes NOEDIT NOWAIT DELETE FILE test.txt |