Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread V3 Strange Delete problem
Sat, Dec 30 2006 2:14 AMPermanent Link

Michael Fullerton
DBISAM V3

I am having a very strange problem. I have two tables A and B. B
contains a field that "links" to the key of A. I have implemented code
in ABeforeDelete to delete records containing the deleted field. That
code will open B if is not open already. Now when I try to delete a
record in a grid or data form using DBNavigator and B is not open the
selected record is not deleted, usually the bottom record is instead.
If B has been opened already before deleting the record in A the
correct record is deleted from A. Any ideas as to what might be
causing this behavior?

___
Free Project Time Tracker for Delphi Developers
http://www.cybermatrix.com/pcdelphi.html
Sun, Dec 31 2006 9:17 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Michael


My guess is its the way you do the "linking". If you have a master-detail set up then the pointer can't be moved in the detail table until its open (mind you Delphi should throw a wobbly if you don't have it open). What happens if you open the detail table and then refresh the master?


Roy Lambert
Tue, Jan 2 2007 1:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< I am having a very strange problem. I have two tables A and B. B contains
a field that "links" to the key of A. I have implemented code in
ABeforeDelete to delete records containing the deleted field. That code will
open B if is not open already. Now when I try to delete a record in a grid
or data form using DBNavigator and B is not open the selected record is not
deleted, usually the bottom record is instead. If B has been opened already
before deleting the record in A the correct record is deleted from A. Any
ideas as to what might be causing this behavior? >>

It's not a good idea to open any table involved in a master-detail linkage.
The reason is that opening will cause record pointer movements in one or
both directions of the linkage, thus possibly destroying any current record
position.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jan 2 2007 2:19 PMPermanent Link

Michael Fullerton
On Sun, 31 Dec 2006 14:11:25 +0000, Roy Lambert
<roy.lambert@skynet.co.uk> wrote:

>Michael
>
>
>My guess is its the way you do the "linking". If you have a master-detail set up then the pointer can't be moved in the detail table until its open (mind you Delphi should throw a wobbly if you don't have it open). What happens if you open the detail table and then refresh the master?

I'm not using Master-detail. I mean linked as in the tables are
JOINable. I think I resolved the problem. The Table B dataentry form
did not have another JOINed table opened (for a DBLookup list). Once I
made sure the table was opened, deletions seem to act normally. Very
creepy.

___
Free Project Time Tracker for Delphi Developers
http://www.cybermatrix.com/pcdelphi.html
Tue, Jan 2 2007 3:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< I'm not using Master-detail. I mean linked as in the tables are JOINable.
I think I resolved the problem. The Table B dataentry form did not have
another JOINed table opened (for a DBLookup list). Once I made sure the
table was opened, deletions seem to act normally. Very creepy. >>

If you want to post the code that you're using, I can tell you exactly what
is going on.  As it stands, I'm kind of just guessing as to what you're
doing.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image