Problems with AfterFetchRecord and afCancel

Jens Fudickar

Member³
I'm using the AfterFetchRecord-Event and the Action afCancel to cancel the selection of data.
After that the dataset-property Active has the value TRUE!!!

Why ??????

I've canceled the dataset and nothing is to see, but the property is true.

Can anyone help?

------------------
 
This is how it works. The dataset is opened, and you cancel the query processing. It remains open though.

------------------
Marco Kalter
Allround Automations
 
Ok, when it works so, then tell me how i can solve the following problem.

An Export-Component, which exports all records of the dataset, checks after each record is the dataset active and after that, is the end of file (dataset) reached. Checking eof raises an exception when the cancel flag is set and the export is canceled with an unhandled exception.
How is it possible to check, that the dataset is canceled?
 
It depends a bit on how your application works. Basically you need boolean variable somewhere in your form or datamodule that indicates that the dataset was cancelled. You can reset it when the dataset is opened, and set it in the AfterFetchRecord event when the dataset is cancelled. You need to check this variable at an appropriate point in your application (after opening the dataset, or after calling Next).

------------------
Marco Kalter
Allround Automations
 
Back
Top