Subject Re: TIBOQuery refresh problem
Author mmenaz
I use native IBO components, not TDataset one, but I think that the situation is the same.
In OnPrepareSql event, the query is being prepared, so I think that you can't reference it's fields here, since have been destoyed and will be rebuild after the prepare. This event is intended for refining the SQL where (using something like SQLWhereItems.Add( 'SALARY>200' ).
When you call "Refresh", you unprepare/prepare the query, if already open, so you will go through the OnPrepareSQL event, where you generate the error.
Hope this will point you torward the right direction. If I'm complitely wrong, apologise.
Marco Menardi
btw, advice: go to native components if you can ;)

--- In IBObjects@y..., "Luiz" <cprmlao@i...> wrote:
> Using a TIBOQuery, if I have some code on event OnPrepareSql making
> reference to fields, and in a TButton event, i code TIBOQuery1.Refresh
> without to call TIBOQuery.InvalidateSql before, I get an error saying 'Field
> XXXX not found'.
> This error appears also when I have a navigator bar and click on Refresh
> Button.
> Does someone can reproduce the same problem?
> PS: IBO4.2Gc and D6.
> Luiz.