i'm having a problem deleting a record in my database.... i have declared
the database OfflineRegDb as a ttable var, and it works apart from the
deleted thing.
cpr + regnr is the indexes...
if OfflineRegDb.FindKey([TempReg.Cpr + TempReg.RegNr]) then
begin
showmessage('1st should be deleted');
OfflineRegDb.Delete;
end;
I can see that it has found the post, but if i try to write a new record
with the same indexes, it delivers an "Key violation" ..... any ideas what
is wrong?! Do i have to set the table to a specific state?? I tried to do a
OfflineRegDb.Post, but it seemed to be for edit/insert only.
I would be very grateful if you can find the error
Yours
Kim
With Your code what You do is following : You check if a record with a
keyvalue "A" exists, although Your tablecursor may be positioned on a record
with a keyvalue "B" (in other words, the Findkey does not move the
tablecursor), and when that record "A" exists, You then delete record "B".
If I am correct, You can test that easily. Do not change Your code and check
the number of records in Your table,
then run through this code once and check your table again. If the record
You wanted to delete is still in the table, You then check the number of
records in Your table again, and if the number is decreased with 1, then You
have deleted the wrong record.
Good hunting
Yves.
I had forgotten to set it to edit mode..... Now the thing works....
well, "thanks anyways" if you have used time on this....
Yours
Kim
Kim Nørby Andersen skrev i meddelelsen <7oi1i4$5h$1...@news101.telia.com>...