Microsoft KB Archive/101295

From BetaArchive Wiki

FoxPro COPY TO ARRAY Behavior with One-Dimensional Arrays

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

Last Reviewed: June 27, 1995
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.