This relates to VFP 6.0
I have been experiencing an intermittent error: 'ATBL' is not an array.
The error occurs in a code snippet that in the init event of a listbox object. The purpose of the code is to determine the number of files in the current or default directory with a .dbf extension and then to populate an array (aTbl), which is the RowSource of the listbox, with the name of the file. I've included the code and indicate the line that produces the error. Thanks in advance for your comments and suggestions.
Public Array aFls(1)
ADIR(aFls,"*.dbf"
&& Populate array with file data
nCounter = 0
For I = 1 to Alen(aFls) Step 5 && Use info only from column 1 of the array
****Next Line Produces Error******
Use aFls(I) In 0 && Open each table
nCounter = nCounter + 1 && determine no. of files.
Next I
Public Array aTbl(1)
Dimension aTbl(nCounter) && dimension aTbl to match number of files.
For I = 1 to nCounter
aTbl(I) = Alias(I) && populate array rows with alias from each work area.
Next I
If ThisForm.Tables.ListCount > 0 && If there is a list --
ThisForm.Tables.ListIndex = 1 && Select the first item in the list
ThisForm.Refresh()
Endif
Select (ThisForm.Tables.Value)
CDavis
I have been experiencing an intermittent error: 'ATBL' is not an array.
The error occurs in a code snippet that in the init event of a listbox object. The purpose of the code is to determine the number of files in the current or default directory with a .dbf extension and then to populate an array (aTbl), which is the RowSource of the listbox, with the name of the file. I've included the code and indicate the line that produces the error. Thanks in advance for your comments and suggestions.
Public Array aFls(1)
ADIR(aFls,"*.dbf"
nCounter = 0
For I = 1 to Alen(aFls) Step 5 && Use info only from column 1 of the array
****Next Line Produces Error******
Use aFls(I) In 0 && Open each table
nCounter = nCounter + 1 && determine no. of files.
Next I
Public Array aTbl(1)
Dimension aTbl(nCounter) && dimension aTbl to match number of files.
For I = 1 to nCounter
aTbl(I) = Alias(I) && populate array rows with alias from each work area.
Next I
If ThisForm.Tables.ListCount > 0 && If there is a list --
ThisForm.Tables.ListIndex = 1 && Select the first item in the list
ThisForm.Refresh()
Endif
Select (ThisForm.Tables.Value)
CDavis