Subject Re: [IBO] wierd error or a bug on ib_query or ib_datetimepicker
Author Paul Vinkenoog
Hello James,

> I cant insert a record for a reason that seems to be so weird. It
> always says "ProduceDate field is a required field but I have input
> the date their. The ib_datetimepicker has a datasource set to
> "Produce" table and its data field to "ProduceDate".
>
> I have made a careful check on how I set up the components, I think
> everything is right. I wonder what is causing this.
>
> I have set the column attributes ofthe "ProduceDate" field to
> required. but in the orignal database design it accept nulls. But
> when I uncheck the required attributes. The error message doesn't
> appear but when I check the record in IB Expert, it has a null value
> on the "ProduceDate". It seems that somethings wrong with my
> ib_datetimepicker. So I drop it and create another one, but it
> didn't fix my problem.

There is indeed a bug in IB_DateTimePicker that manifests itself when
the dataset is in dssInsert state, i.e. when you are working on a
newly inserted record. Here's a workaround:

- create an OnChange handler for the IB_DateTimePicker with this body:

if ( MyDataset->State == dssInsert )
((TIB_DateTimePicker *) Sender)->Checked = true;

If you use Delphi, I think it's:

if MyDataset.State = dssInsert
then (Sender as TIB_DateTimePicker).Checked := true;


Note: You can still set ShowCheckbox to whatever you prefer.


Maybe I'll try and fix this bug if I have a little time left this
week.


HTH,
Paul Vinkenoog