FoxPro COPY TO ARRAY Behavior with One-Dimensional Arrays

Last reviewed: June 27, 1995
Article ID: Q101295
The information in this article applies to:
  • Microsoft FoxPro for MS-DOS, versions 2.5 and 2.50a
  • Microsoft FoxPro for Windows, versions 2.5 and 2.50a

When you use the COPY TO ARRAY command to move all records in a database to an array, only the first record will be copied into the array depending on how the array has been dimensioned.

When the array has been created using DIMENSION MYARRAY(n), a one- dimensional array of n elements will be created. However, when you attempt to use the COPY TO ARRAY MYARRAY command, only the first record will appear in the array.

To copy all database records into the array, you must dimension the array as follows:

  DIMENSION myarray(<# of records>,<# of fields>)

Another workaround is to not DIMENSION the array before issuing the COPY TO ARRAY command. If the array does not exist, it will be created in the same format as if DIMENSION MYARRAY(n,1) were issued.


Additional reference words: FoxDos FoxWin 2.50 2.50a DIMENSION COPY TO
ARRAY
KBCategory: kbprg
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: June 27, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.