Alpha Video Training
Results 1 to 5 of 5

Thread: <tbl>.delete() problem

  1. #1
    Member
    Real Name
    Arlen Troup
    Join Date
    Feb 2003
    Posts
    145

    Default <tbl>.delete() problem

    I have attached a small database to illustrate my problem with <tbl>.delete().

    This seems like a simple task so I suspect there is a simple fix but in my ignorance I can't determine why this doesn't work.

    In the attached DB there is a script ("delete") to delete selected records from a table. This example contains 62 records that should be selected for deletion. The first time I run the script 37 records of the 62 are deleted. If I run the script a second time 17 more records are deleted. The third run deletes 5 records, the fourth run deletes 2 records and the fifth time I run the script the last record is deleted. How can I delete all the 62 records with 1 run of the script?

  2. #2
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,657

    Default Re: <tbl>.delete() problem

    Arlen

    One of the things that delete does is reposition the pointer to the next record in sequence. Remember, you just deleted a record so it can't point to the newly deleted record and it has to point at something..... so it chooses the next record..

    So change your code slightly to do a fetch_next if a delete wasn't done and not if a delete was done...
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    "Certified" Alphaholic
    Real Name
    Bill Belanger
    Join Date
    Sep 2003
    Location
    Caribou Maine
    Posts
    1,053

    Default Re: <tbl>.delete() problem

    Why wouldn't <tbl>.delete_range() work?

    Bill Belanger

  4. #4
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,313

    Default Re: <tbl>.delete() problem

    Bill, sure, your approach would work, but it wouldn't explain Arlen's script behavior. Al's explanation is right on target. -- tom

  5. #5
    Member
    Real Name
    Arlen Troup
    Join Date
    Feb 2003
    Posts
    145

    Default Re: <tbl>.delete() problem

    Al,

    Thanks for enlightening me. Your suggestion fixed the problem.

Similar Threads

  1. <TBL>.DELETE() - not what you might think
    By michaelklein in forum Alpha Five Version 5
    Replies: 13
    Last Post: 04-21-2004, 08:16 AM
  2. Delete problem
    By Ronald Anusiewicz in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-01-2004, 05:14 AM
  3. <tbl>.fetch_eof() problem
    By David Farr in forum Alpha Five Version 5
    Replies: 4
    Last Post: 10-14-2003, 05:38 AM
  4. Cpy Flds in currnt tbl & post to other tbl
    By Danny Marx in forum Alpha Five Version 4
    Replies: 8
    Last Post: 08-24-2000, 10:08 AM
  5. Delete Problem
    By Rodger Bailey in forum Alpha Five Version 4
    Replies: 7
    Last Post: 06-10-2000, 07:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •