Alpha Video Training
Results 1 to 10 of 10

Thread: Control "Delete Record" in an embedded browse

  1. #1
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default Control "Delete Record" in an embedded browse

    I have an embedded browse in a form that is the child table in a one-to-many set. It is the typical detail section of an invoice-like entry.

    What I want to do is restrict the option to delete a record in the browse by way of entering a password. I tried setting up a custom menu which asks for a password before deleting the record, however I believe when the user is prompted for a password, focus is changing from the browse to the parent, or header, record. When the password is entered, instead of deleting just the one line item in the detail section, the entire header record is deleted. Any advice would be greatly appreciated. TIA :)

  2. #2
    VAR
    Real Name
    Cheryl Lemire
    Join Date
    Jul 2003
    Location
    Pembroke Pines, FL
    Posts
    2,914

    Default

    Hi Shawn,

    I tend to shy away from allowing users to delete records from within a browse. One possibility would be to prompt for your password and then load a separate form with only the current selected record loaded, have a delete key on this form that after deleted closes the form and returns you to where you started.

    Good luck
    Cheryl

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

    Default

    Shawn, the easiest solution for someone just getting started with Alpha Five would be to make the browse object read only. Then put a button on the form and let the button's onPush event run a script that checks the user's credentials before deleting the record.

    More experienced folks could do the same thing in the CanDeleteRecord event for the table in field rules.

    -- tom

  4. #4
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default

    Hi Tom,

    That's basically what I did (i.e. create a delete button on the form)... The script asks for a password (basically a confirmation that it's OK to delete the record). However, once the password is entered and you get the standard "Ok to delete?" and say "Yes", the HEADER record get's deleted - not the record in the browse... it seems as though once the button is pushed, focus shifts from the browse to the parent. Any ideas? Thanks.

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

    Default

    Hi Shawn,

    change the script so that the currently selected row in the browse object is deleted.

    show us your existing script and maybe we can help.

    show us the database, with directions to the form and I know we can help.

    -- tom

  6. #6
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default Here it is

    Hi Tom,

    Database is attached (password is "change" for anything that asks for it). Please see the "Paycard" form. I've removed the script I had attached to the right-click menu for the browse -- that's where I was having the problem. There is also a delete button on the form, but that's for the parent record. Any help you can provide would be great.
    Last edited by smrogers; 03-22-2006 at 05:16 PM.

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

    Default

    Shawn,

    Your script is using an action that executes the "Records | Delete" menu choice from the form's menu. This menu item always runs against the primary table supporting the form.

    You should delete that action, and replace it with Delete Record action from the Records Category. The genie will give you the option to select whether to delete the current primary table record or the record currently selected in your browse object.

    -- tom

  8. #8
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default

    Thanks Tom... appreciate your taking a look. I thought that I did what you mentioned, but I could be wrong -- I don't recall the option to select primary table or browse object, so I must have choosen something else. Thanks again.

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

    Default

    Perhaps I wasn't clear. If you want the Delete button on the Paycard form to delete the currently selected row in the embedded browse, make the mods I've recommended. -- tom

  10. #10
    Member smrogers's Avatar
    Real Name
    Shawn Rogers
    Join Date
    Feb 2006
    Location
    Reading, MA / 15 Miles North of Boston
    Posts
    516

    Default

    All set -- I left the button on the form as is (to delete the parent record and associated child records). I changed the right-click menu associated with the browse to run a script as you suggested, which deletes the record from the BROWSE... which is what I wanted. Thanks again!

Similar Threads

  1. Duplicating a "Parent" record complete with "Children"
    By Peterg in forum Alpha Five Version 7
    Replies: 4
    Last Post: 02-23-2006, 10:40 AM
  2. Control "bleeding" into top tabbed page ???
    By RobertJWilkins in forum Alpha Five Version 6
    Replies: 1
    Last Post: 12-02-2005, 06:33 PM
  3. How to capture return "Delete this record".
    By Tony Saladino in forum Alpha Five Version 6
    Replies: 2
    Last Post: 11-14-2005, 06:18 PM
  4. "Undo on delete" not working...
    By John Toalson in forum Alpha Five Version 4
    Replies: 3
    Last Post: 04-21-2001, 05:32 PM
  5. Detect "Enter" on embedded Browse
    By Stephen Williams in forum Alpha Five Version 4
    Replies: 5
    Last Post: 09-16-2000, 06:44 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
  •