Microsoft KB Archive/109842

INF: How to Copy a General Field from One Record to Another

PSS ID Number: Q109842 Article last modified on 01-12-1994

2.50 2.50a 2.50b WINDOWS

= SUMMARY =

You can copy a general field from one record to another by using the KEYBOARD command and the CTRL+C (copy) key combination to place the OLE object in the Windows Clipboard. You can then use the CTRL+V (paste) key combination to insert the OLE object in the general field of the target record. See below for more details and a code sample.

= MORE INFORMATION =

Go to the record containing the general field you want to copy. Use the KEYBOARD command to issue CTRL+C and CTRL+W. Open a window for the process to take place in. Go to the record containing the general field you want to contain the OLE object you now have on the Clipboard. Use the KEYBOARD command to issue CTRL+V and CTRL+W. Open a window for the process to take place in.

Example
The following code example uses the sample files that come with FoxPro for Windows. In the FOXPROWdirectory, there is a table called OLETABLE. This table contains a general field called OBJECT. WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code “as is” without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

''Use the database. IF !USED(‘oletable’) SELECT 0 USE oletable ELSE SELECT oletable ENDIF ''Set record pointer to source record WAIT WINDOW NOWAIT ‘Select Source record…’ BROWSE fieldname=‘OLETABLE.OBJECT’ DEFINE WINDOW updt_ole AT 5,15 SIZE 2,90 FONT “FoxPrint” TITLE “Copying”+; &quot; General field &fieldname from record &quot;+ltrim(str(recno)) ACTIVATE WINDOW updt_ole KEYBOARD ‘{Ctrl+C}’ KEYBOARD ‘{Ctrl+W}’ MODIFY GENERAL (fieldname) IN WINDOW updt_ole RELEASE WINDOW updt_ole *Set record pointer to destination record WAIT WINDOW NOWAIT ‘Select Destination record…’ BROWSE fieldname=‘OLETABLE.OBJECT’ DEFINE WINDOW copymsg AT 5,15 SIZE 2,90 FONT “FoxPrint” TITLE; “Pasting to”+“&fieldname in record”+ltrim(str(recno)) ACTIVATE WINDOW copymsg KEYBOARD ‘{Ctrl+V}’ KEYBOARD ‘{Ctrl+W}’ MODIFY GENERAL (fieldname) IN copymsg RELEASE WINDOW copymsg WAIT WINDOW NOWAIT “Done!”

= Additional reference words: 2.50 2.50a 2.50b =

Copyright Microsoft Corporation 1994.