Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2003
    Posts
    8

    Red face Unanswered: Deleting A FoxPro 2.5 Record From Specific Field

    I have a FoxPro 2.5 Program that I need to add a function to Delete a Record..

    Example: User presses D to delete that Record.

    How do I do this?? I am a newbie and am having all kinds of trouble with the only!!!


    Thanks

  2. #2
    Join Date
    Dec 2003
    Posts
    104

    Re: Deleting A FoxPro 2.5 Record From Specific Field

    Originally posted by Seahawk0966
    I have a FoxPro 2.5 Program that I need to add a function to Delete a Record..

    Example: User presses D to delete that Record.

    How do I do this?? I am a newbie and am having all kinds of trouble with the only!!!


    Thanks
    There are several ways to code this, but it depends on what the user interface is at that point.
    If it is in a BROWSE window, and they just wanted to type the letter 'D', you wouldn't want them to end up deleting that record. However, <Ctrl><T> will delete/recall a record (toggle the delete mark on or off).
    If it is a command button on a screen, make the caption read \<Delete, which will underline the 'D', making it a shortcut key. Then you can have a function in the valid snippet of the command button something like delrec():

    In the cleanup/procedures, add this code:
    FUNCTION delrec
    DELETE
    RETURN .T.
    DSummZZZ

    Even more Fox stuff at
    www.davesummers.net/foxprolinks.htm

  3. #3
    Join Date
    Dec 2003
    Posts
    8

    Talking

    Thank you for your reply...

    It worked and I also had to add at the top of the program

    use master
    pack

    so that when they went back into the program that it automatically will pack and reindex the database for me...


    But other then that it worked just like I wanted ,,

    Thanks again

  4. #4
    Join Date
    Dec 2003
    Posts
    104
    Actually, I omitted the PACK portion on purpose because that is really a maintenance function that is usually performed during down time.
    Deleting the records, as you know, only marks them for deletion. In other words, flags them for removal using the PACK command.
    While PACK works just fine, it is not condusive to a multi-user environment as the table needs to be open for exclusive use in order for the pack to execute.
    What you would normally do (especailly in a multi-user environment) is issue the command:
    SET DELETED ON
    This command disallows deleted records from being displayed or accessed. They can then be packed at a later date.
    DSummZZZ

    Even more Fox stuff at
    www.davesummers.net/foxprolinks.htm

Posting Permissions

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