PRB: COPY TO ARRAY "<Array> Is Not An Array" ErrorLast reviewed: April 17, 1995Article ID: Q93332 |
The information in this article applies to:
SYMPTOMSThe COPY TO ARRAY command returns an "'<array name>' is not an array" error message.
CAUSEThe error "'<array name>' is not an array" occurs when you are using the COPY TO ARRAY command if none of the records meet the FOR condition criteria. For example, the error occurs if you issue the following command
USE C:\FOXPRO\TUTORIAL\CUSTOMER COPY TO ARRAY FOR STATE = "AA"because none of the records in the database match the FOR condition.
RESOLUTIONIf you use the COPY TO ARRAY FOR command, verify that the FOR condition is met prior to issuing the command. You can use the SEEK command to accomplish this. For example:
USE C:\FOXPRO\TUTORIAL\CUSTOMER
SET ORDER TO TAG STATE
SEEK "AA"
IF FOUND()
COPY TO ARRAY MYARRAY FOR STATE = "AA"
ENDIF
The COPY TO ARRAY command has a WHILE clause, which can be used to
copy the records to the array if the record pointer is positioned on a
record that does meet the WHILE condition. If you issue the COPY TO
ARRAY WHILE command and the record pointer is not on a record that
meets the WHILE condition, the message "0 records copied" is
displayed.
To reproduce this condition, enter the following commands in the Command window:
USE C:\FOXPRO2\TUTORIAL\CUSTOMER.DBF ORDER state COPY TO ARRAY myarray WHILE state = "NY" Message "0 records copied"To avoid this error, use the SEEK command to position the record pointer on a record that meets the WHILE condition before creating the array. The database must be ordered on the field that is tested in the WHILE clause. It may also be necessary to test for the case in which no records meet the WHILE condition.
MORE INFORMATION
Example 1
USE C:\FOXPRO2\TUTORIAL\CUSTOMER.DBF ORDER state
IF SEEK ("NY")
COPY TO ARRAY myarray WHILE state = "NY"
ELSE
WAIT WINDOW "No matching records"
ENDIF
Example 2
USE C:\FOXPRO2\TUTORIAL\CUSTOMER.DBF ORDER state SEEK "NY" COPY TO ARRAY myarray WHILE state = "NY" REFERENCES"Microsoft FoxPro Commands & Functions" Page C3-243
|
Additional reference words: FoxDos 2.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |