Subject Re: [IBO] Invalid variant operation
Author Helen Borrie
At 09:00 AM 19/01/2004 +0000, you wrote:
>Hi
>
>I have recently bought IBO.
>I have used GReplace to switch from BDE to IBO.
>I can start my appl. now, but I have some TIBOQuery (from the
>iboTDataset palette).
>To those I have attached some TDataSource. This because they have to
>be viewed in a TDBGrid (or TRxDBGrid).
>Sometimes I have a another TIBOQuery which is actually a subdetail
>using the first TIBOQuery's TDataSource as DataSource.
>
>I.e.
>
>I have a TIBOQuery which does this:
>
>Select * from MyTable Where Some "Conditions"
>
>
>Then I have another TIBOQuery which is:
>
>Select Sum(AField) from MyTable2 where AField = :AField
>
>The :AField comes from the first TIBOQuery's datasource but I get
>this error when opening the subdetail query:
>
>Invalid variant operation
>
>Should I do something special to have this work ?

Yes, look at all your ParamByName, Params, FieldByName and Fields
references, where you use the ".Value" method and replace any problem ones
with ".AsWhatever", i.e. explicit casting.

Another source of this problem could be NULLs being treated as values. IBO
doesn't convert nulls to values unless you explicitly tell it to. This is
fairly complicated to do with TIBOQuery so it's better to test the column
object's IsNull property before trying to read a Value from it.

Helen