General information
Category:
Coding, syntax & commands
Yes, your right Garrett. The example I showed you was of a temp table and yeah I guess the code was redundant. Thanks. However, I still have a problem with the indexes I created using SET INDEX TO. After I am done with the cursors I'd like to have the idx files removed otherwise the next time I run a report I get the message asking if I want to overwrite the current idx file. The way you suggested gives me the same error 'File is in use'. Any other tips on how to solve this issue?
>>I am currently running a report, using cursors as the data sources. After the
>>cursors are built, I create an index. When the report is complete I want to
>>remove the cursors and the index, however I am having difficulties removing the
>>index file (IDX).
>
>>IF USED("Probill")
>> SELECT Probill
>> USE
>> DELETE FILE Probill.dbf
>> IF FILE("Probill.idx")
>> DELETE FILE Probill.idx
>> ENDIF
>>ELSE
>> IF FILE("Probill.dbf")
>> DELETE FILE Probill.dbf
>> ENDIF
>> IF FILE("Probill.idx")
>> DELETE FILE Probill.idx
>> ENDIF
>>ENDIF
>
>
>It doesn't look here as if you're using cursors, but rather a temp table.
>If you actually use a cursor (CREATE CURSOR...), and then create a CDX on it, both will be automatically deleted when you stop using the cursor.
>
>Also, your code is redundant. It would be better as:
>
>IF USED("Probill")
> USE IN proBill
>ENDif
>IF FILE("Probill.dbf")
> DELETE FILE Probill.dbf
>ENDIF
>IF FILE("Probill.idx")
> DELETE FILE Probill.idx
>ENDIF
>
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only