m.lcFileName = allTRIM(thisform.text5.value)+"a" + "." + laFiles(x) means that m.lcFileName will become test5a.pdf test5a.tif test5a.jpg etc LOCATE FOR m.lcFileName = allTRIM(thisform.text5.value)+"b" + "." + laFiles(x)&¬ work1. You are doing a LOCATE in a table, but you aren't specifying anything in the table to check for. If your condition is true you will always be at the first record, otherwise you will always be at EOF(). You can never wind up at any other record.
LOCATE FOR "test5a.pdf" = "test5b.pdf" LOCATE FOR "test5a.tif" = "test5b.tif" LOCATE FOR "test5a.jpg" = "test5b.jpg" etcIn other words, conditions that can never be true so the value of FOUND() will always be FALSE and the values for Text9, Text10, and Text11 will never get updated.
>SET DEFAULT TO "\\istweb-devlop\error\arttachment" > >DIMENSION laFiles(8) >laFiles[1] = "pdf" >laFiles[2] = "tif" >laFiles[3] = "jpg" >laFiles[4] = "gif" >laFiles[5] = "bmp" >laFiles[6] = "doc" >laFiles[7] = "docx" >laFiles[8] = "rar" >FOR x = 1 TO ALEN(laFiles) > m.lcFileName = allTRIM(thisform.text5.value)+"a" + "." + laFiles(x) > thisform.text8.Value=allTRIM(thisform.text5.value)+"a" + "." + laFiles(x)&& it works > ************************************************************************************* > LOCATE FOR m.lcFileName = allTRIM(thisform.text5.value)+"b" + "." + laFiles(x)&¬ work > IF FOUND() > thisform.text9.Value=allTRIM(thisform.text5.value)+"b" + "." + laFiles(x) > endif > >LOCATE FOR m.lcFileName = allTRIM(thisform.text5.value)+"c" + "." + laFiles(x)&¬ work > IF FOUND() > thisform.text10.Value=allTRIM(thisform.text5.value)+"c" + "." + laFiles(x) > endif > >LOCATE FOR m.lcFileName = allTRIM(thisform.text5.value)+"d" + "." + laFiles(x)&¬ work > IF FOUND() > thisform.text11.Value=allTRIM(thisform.text5.value)+"d" + "." + laFiles(x) > endif > > > >****************************************************************************************** > IF FILE(m.lcFileName) > EXIT > ENDIF >ENDFOR > > > > If File(m.lcFileName) > > Declare Long ShellExecute In "shell32.dll" ; > long HWnd, String lpszOp, ; > string lpszFile, String lpszParams, ; > string lpszDir, Long nShowCmd > > lnResult = ShellExecute(0,'Open', m.lcFileName, 0,0,1) > IF !(m.lnResult > 32) > endif > Else > > MESSAGEBOX("not found") > ENDIF > > >>thanks