How to blank data aware components in 1-1-1 non-normal

We have a form that uses non-normal methods and references 3 records, all
related. The first record (owner) is basic name and address stuff, the
second (supplemental) is needed if we want to track more complex information
and the third (custom) is an end-user customizable record. Each record has a
unique ID, but the latter 2 also contain reference fields to the owner.

When we Append a new owner (SQL based using TQueries), the OnNewRecord event
or the owner fires 2 Appends to create a supplemental and a custom record.
The OnNewRecord event of those records includes putting the OwnerID into the
appropriate fields. To the user, it all looks like one record, of course.

If the user accesses an existing record, we use the OnDataChange event and a
SELET to load any supplemental and custom records.

No problem so far.

However, when we delete the owner, then, in the BeforeDelete event of the
owner, we trigger ExecSQL statements to first delete any supplemental and
custom records, followed by the delete of the owner.

Now the problem: after delete, the form should be blank. It is for the owner
record, but the data in the data-aware components related to the
supplemental and custom records is still visible, even though those records
are gone. The reason: we use a standard "general purpose" TQuery for all
delete SQL functions, rather than using the TQueries linked to the form for
the supplemental and custom records. That's because we don't want to go
through changing RequestLive to false, then performing the delete, then
changing RequestLive back to true for those tables. Further, we use one
standard TQuery for all extraneous actions, like deletes.

I realize we could do something like this:

with SupplementalTable do
try
    RequestLive := false;
    SQL.Clear;
    SQL.Add('delete from supplemental where supplemental.ownerid = ' +
instring)
    Prepare
    ExecSQL;
finally
    RequestLive := true;
end;

with CustomTable do
try
    RequestLive := false;
    SQL.Clear;
    SQL.Add('delete from custom where custom.ownerid = ' + instring)
    Prepare
    ExecSQL;
finally
    RequestLive := true;
end;

but this is easier:

with StandardQuery do
begin
    SQL.Clear;
    SQL.Add('delete from supplemental where supplemental.ownerid = ' +
instring)
    Prepare
    ExecSQL;
    SQL.Clear;
    SQL.Add('delete from custom where custom.ownerid = ' + instring)
    Prepare
    ExecSQL;
end;

So I need a command to blank the data aware components. What we end up doing
now is reselecting the supp and custom records using a bogus number, like
this:

with SupplementalTable do
begin
    SQL.Clear;
    SQL.Add('select * from supplemental where supplemental.ownerid = -1');
    Prepare;
    Active := true;
end;

This at least ensures the data aware components will be cleared, but it
defeats the purpose of the general purpose TQuery.

Any ideas?

Fred

--
fr...@silk.nospam.net
(remove the "nospam" on reply)
Fred R. Dalgleish
Dalco Consulting