Board index » delphi » TBDEDataset.Post keeps changing current record

TBDEDataset.Post keeps changing current record

Ok...so maybe this is how it is supposed to work, but when I call the post
method of a TTable, is it supposed to change the current record pointer?  If
so, all I can say is "Ugh".  Is there no way to affect a change in the
database without moving off the current record?

Assuming that is the case, I've come up with this rather cumbersome piece of
code to work around it.  Any other suggestions?

with tblPendingEvents do begin
  Current := GetBookmark;
  Edit;
  FieldByName('Transferred').AsBoolean := True;
  FieldByName('Log_Link').AsInteger := Result;
  Post;
  GotoBookmark(Current);
  FreeBookmark(Current);
  end;

Thanks in advance,
  Chris Tourville
  PC Programmer Senior
  County of Lancaster, PA

 

Re:TBDEDataset.Post keeps changing current record


Post doesn't change the record pointer.  However, if you're using a filtered
table or a live query, and change a key, it's possible that the current
record is going out of scope.

Paul / ColumbuSoft
www.columbusoft.com

Quote
Chris Tourville <tourv...@co.lancaster.pa.us> wrote in message

news:8aodau$ss55@bornews.borland.com...
Quote
> Ok...so maybe this is how it is supposed to work, but when I call the post
> method of a TTable, is it supposed to change the current record pointer?
If
> so, all I can say is "Ugh".  Is there no way to affect a change in the
> database without moving off the current record?

> Assuming that is the case, I've come up with this rather cumbersome piece
of
> code to work around it.  Any other suggestions?

> with tblPendingEvents do begin
>   Current := GetBookmark;
>   Edit;
>   FieldByName('Transferred').AsBoolean := True;
>   FieldByName('Log_Link').AsInteger := Result;
>   Post;
>   GotoBookmark(Current);
>   FreeBookmark(Current);
>   end;

> Thanks in advance,
>   Chris Tourville
>   PC Programmer Senior
>   County of Lancaster, PA

Re:TBDEDataset.Post keeps changing current record


Awwwww, geeez.  Don't I feel like a fool.

I knew it didn't make sense for the record pointer to change on a post.
That's exactly what's happening...I'm filtering on both Log_Link and
Transferred.  So the record is going away before I'm done with it.

Thanks a million...I'm _not_ going insane...just a little stupid today.

Quote
Paul Ferrara <p...@nospam.columbusoft.com> wrote in message

news:8aoioc$t3i2@bornews.borland.com...
Quote
> Post doesn't change the record pointer.  However, if you're using a
filtered
> table or a live query, and change a key, it's possible that the current
> record is going out of scope.

> Paul / ColumbuSoft
> www.columbusoft.com

> Chris Tourville <tourv...@co.lancaster.pa.us> wrote in message
> news:8aodau$ss55@bornews.borland.com...
> > Ok...so maybe this is how it is supposed to work, but when I call the
post
> > method of a TTable, is it supposed to change the current record pointer?
> If
> > so, all I can say is "Ugh".  Is there no way to affect a change in the
> > database without moving off the current record?

> > Assuming that is the case, I've come up with this rather cumbersome
piece
> of
> > code to work around it.  Any other suggestions?

> > with tblPendingEvents do begin
> >   Current := GetBookmark;
> >   Edit;
> >   FieldByName('Transferred').AsBoolean := True;
> >   FieldByName('Log_Link').AsInteger := Result;
> >   Post;
> >   GotoBookmark(Current);
> >   FreeBookmark(Current);
> >   end;

> > Thanks in advance,
> >   Chris Tourville
> >   PC Programmer Senior
> >   County of Lancaster, PA

Other Threads