[Lazarus] Master-detail problem

Michael Van Canneyt michael at freepascal.org
Thu Mar 29 17:22:51 CEST 2012

On Thu, 29 Mar 2012, Koenraad Lelong wrote:

> Hi,
> I made a application using a master-detail construction.
> I want to have the detail table follow a master-field, and I want to specify 
> another condition for the detail. This seems not to work. I get an error 
> stating the master-table does not contain a field with the name of my manual 
> parameter.
> SQL of master :
> select worker_number, worker_name
> from worker_table
> SQL of detail :
> select *
> from work_table
> where worker_number=:worker_number
> and work_date between :from_date and :to_date
> When I try to open my master-table I get an error : field :from_date not 
> found in table sqlWorker (=the name of the TSQLquery of the master-table).
> When I remove the between clause, everyting is OK.
> What am I doing wrong ?

You must set the value of the :from_date and :to_date in code in the BeforeOpen event.
If datasource is set, then ALL values of all unbound parameters are set in the Open event.
Setting the parameter 'binds' it, and then it's value will no longer be fetched from the 


More information about the Lazarus mailing list