>Fabio, tried as you proposed but seems no luck:
>
>If CDX exist I got "TABLE OPEN AT TRY: 1" and if not "TABLE OPEN AT TRY: 2" but ON ERROR is
>not triggered ?!
>
>Gojko
Gojko,
now remember this issue ( a bug ).
I post it some months ago.
The first time,
besides producing the error,
VFP removes the definition of the cdx,
in this way the second time cannot verify him the error.
Logic is:
you have lost the CDX, then we remove the link to him from the table,
and we shoot you an error, with which you can restore the CDX,
if you don't do then it it means that it doesn't interest yourself
to have it lost.
It can apparently have sense,
because if the link is considered as "one cdx exists",
then it won't be possible to create a new cdx,
BUT this is the logic bad start point,
because the true meaning of the flag is
"it looks for a struct cdx and if it exists open it,
otherwise fire a error".
This produces to serious problem that is the motive
for which I call it "design bug",
because if for some reason during the resolution of the first error
something doesn't work (App crash, VFP crash, OS c... )
the following time finds again yourself without cdx and without errors.
Probably after a certain number of lines it will occur an error,
but it is easy to write an example where the data it can be ruined
without the application can realize of it.
This myopic vision is present in many VFP places.
#DEFINE TABLENAME testtableX
CLEAR
SET STEP ON
CLOSE DATABASES ALL
CLOSE TABLES ALL
CREATE TABLE TABLENAME FREE (AA I)
INDEX ON AA TAG T1
USE
ERASE FORCEEXT([TABLENAME],"CDX")
ON ERROR ? ERROR(),MESSAGE()
SELECT 0
USE TABLENAME ALIAS TIPOO
? "ALIAS ",ALIAS()
USE TABLENAME ALIAS TIPOO
IF ISBLANK(CDX(1))
USE
ERROR 1707
ENDIF
? "ALIAS ",ALIAS(),"STRUCTURAL INDEX :",CDX(1)
CLOSE TABLES ALL
ERASE FORCEEXT([TABLENAME],"*")