Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array won't build

Status
Not open for further replies.

starmistress

IS-IT--Management
Apr 16, 2001
32
US
What are some possible reasons that an array will not get buildt. When the program runs I get an error stating that 'Variable "AIMAGES" Not Found'. The code is as follows:

&& array of images in the directory of the text line
nImages = adir(aImages, cImgDir + '\*.tif')
if nImages < 1
_text = nErrorHandle
\\No images found for <<cImgDir>>
endiff




 
Straight from the MSDN help file:

&quot;If the array doesn't exist and ADIR( ) returns 0, the array isn't created.&quot;

The best way to avoid the error you're encountering is to either A) Create the array before issuing ADIR() or B) When nImages returns 0, don't try to access your array.
 
But I know that there is info to be returned. This portion of the program will work on a different machine. Is there an ODBC issue that could stop an array from being built?
 
Any chance there are embedded spaces in the cImgDir variable? To protect yourself, you might want to go with:

cImgFileMask = '&quot;'+cImgDir + '\*.tif&quot;'
nImages = adir(aImages, cImgFileMask)
if VARTYPE(aImages)<> &quot;U&quot; or nImages < 1


Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top