I'm still on find out... here some infos:
At first I open the "select * from post_data..." query. In the OnAfterScroll-event I open the second ("select * from history..."; here query2) query. What I do is to set query2.filter with a term containing a value of the first query and set filtered to true. And then the call of query2.open raises the error now. So I tried to start my program without open the second query. It works.
BUT
My program gui contains a pagecontrol with 2 tabsheets. the first shown tabsheet contains only a dbgrid.
If I want to change the visible tabsheet (containing several data access components) the error raises again. But query2 is not opened.
Now I think the error was raised by an data access component, maybe a DBCheckBox. I don't know.
I'll try to find out more...
PS:
Can you maybe try
and not(appointment_0 is null)
instead of
and appointment_0 is not null
This doesn't affect the behaviour. :-(