lcCheck = SUBSTR(m.lcStyle, 1, AT(m.lcNumberPart, m.lcStyle) + LEN(m.lcNumberPart) - 1) IF ADIR(laFiles, m.HomeImg + m.lcCheck + "*." + m.tcExt) >=1 FOR lnI = 1 TO ALEN(laFiles,1) lcEnd = STRTRAN(JUSTSTEM(laFiles[m.lnI,1]), m.lcCheck, "") IF EMPTY(m.lcEnd) OR ISALPHA(m.lcEnd) lcFile = m.HomeImg + laFiles[m.lnI,1] && Pick up the first file if we have more than 1 EXIT ENDIF NEXT ENDIFe.g. I always check, if ADIR returns one or more elements and then access the file name using lnI,1 in the FOR loop. I don't see how this may produce the above error.