Board index » delphi » Master/Detail problem with empty Access tables

Master/Detail problem with empty Access tables

Using Delphi 3, Access 97 and BDE 4.51, here's my problem:
When I set up a master/detail relationship (using MasterSource and
MasterFields in the detail table) Delphi raises a "At beginning of
table" exception.  At first I thought it was because the detail
table's range of records was empty when starting out with a new master
record (the user will populate the detail table).  But as it turns
out, this is only a problem when the ENTIRE table is empty.  As soon
as I have even one record in detail all exceptions go away, even on
subsequent new master records.  Okay.  Fine.  But that still doesn't
help me at the very beginning of the program's life cycle -- when the
detail table is completely blank.  Having a "dummy" master/detail
record set by default, just to avoid the exceptions, seems sloppy to
me.  But is my only other recourse to trap and deal with the
exceptions myself?  Seems like a lot of trouble just to deal with a
one-time condition.

-Marcus

 

Re:Master/Detail problem with empty Access tables


Quote
Marcus Spurkel wrote:
> Using Delphi 3, Access 97 and BDE 4.51, here's my problem:
> When I set up a master/detail relationship (using MasterSource and
> MasterFields in the detail table) Delphi raises a "At beginning of
> table" exception.  At first I thought it was because the detail
> table's range of records was empty when starting out with a new master

> record (the user will populate the detail table).  But as it turns
> out, this is only a problem when the ENTIRE table is empty.  As soon
> as I have even one record in detail all exceptions go away, even on
> subsequent new master records.  Okay.  Fine.  But that still doesn't
> help me at the very beginning of the program's life cycle -- when the
> detail table is completely blank.  Having a "dummy" master/detail
> record set by default, just to avoid the exceptions, seems sloppy to
> me.  But is my only other recourse to trap and deal with the
> exceptions myself?  Seems like a lot of trouble just to deal with a
> one-time condition.

> -Marcus

Well this is not right you must track down what actuall command
generates this error and eclosed in a try except trap like this.

e.g you have a table and you want to put a filter on it from the
begining of the table the command that generates this message is
table1.filtered:=true; so you go like this

try
  table1.filtered:=true;
except
  {you can place any exception handling code here or live empty}
end;

This will prevent the message from apiaring in your app not prevent from
hapened.

Regards

Johnny

Re:Master/Detail problem with empty Access tables


Sorry wrong solution haven't anderstand the question

Really sorry

Johnny

Re:Master/Detail problem with empty Access tables


Quote
Marcus Spurkel wrote:
> Using Delphi 3, Access 97 and BDE 4.51, here's my problem:
> When I set up a master/detail relationship (using MasterSource and
> MasterFields in the detail table) Delphi raises a "At beginning of
> table" exception.  At first I thought it was because the detail
> table's range of records was empty when starting out with a new master

> record (the user will populate the detail table).  But as it turns
> out, this is only a problem when the ENTIRE table is empty.  As soon
> as I have even one record in detail all exceptions go away, even on
> subsequent new master records.  Okay.  Fine.  But that still doesn't
> help me at the very beginning of the program's life cycle -- when the
> detail table is completely blank.  Having a "dummy" master/detail
> record set by default, just to avoid the exceptions, seems sloppy to
> me.  But is my only other recourse to trap and deal with the
> exceptions myself?  Seems like a lot of trouble just to deal with a
> one-time condition.

> -Marcus

   You are right this is a nug

The only think I can find out is to place some code in the creation of
the datamodule to check if the spefied files are empty if yes then
create a dummy rec else search for the dummy rec and delete it.This
ofcourse means that you have to manually open tables.
If anyone have a better solution please post it here

Thanks in advance.

Regards

Johnny

Other Threads