Results 1 to 10 of 10
  1. #1
    Join Date
    Jul 2009
    Posts
    185

    Unanswered: AfterDelete event?

    Can I tell in afterdelete event if the user press yes or no?

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what did the help system suggest.

    highlight the text and press the F1 key

    As I don't come across afterdelete, I'm guessing this is a Access V12/ZA2007 property. The wording would suggest to me that its after the delete has run so you would only hit that event after the record was deleteed, and therefore its probably you woudl only hit that event after the user had pressed 'Yes'.

    but if you want to be =certain scatter some code in eqach and every property you are interested in so you can see waht happens as you go through the sequence. historically with a new version of Access I've put a series of MsgBox to alet me to the sequence and how to get to that event
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jul 2009
    Posts
    185
    I am using Access 2000 from what I read and test the event triggers both for a yes and for a no. Dumb so trigger for a no I think.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    ..thats odd
    I've only got a afterdelconfirm.... mind you I am using A2003/XP
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jul 2009
    Posts
    185
    Sorry this what I have
    Private Sub Form_AfterDelConfirm(Status As Integer)
    MsgBox "AfterDelConfirm"
    End Sub
    It get called either a yes or no

  6. #6
    Join Date
    Jul 2009
    Posts
    185
    Surely their is a property set by the user's response! I wish I could go back to Clarion for this just a little issue in Clarion. But Alas this has to be in Access. I have got a form that I control when it adds to the table. I guess I can make a edit only, add only, and delete only form to fix this problem. But can I disable the Access delete icon??

  7. #7
    Join Date
    Jul 2009
    Posts
    185
    I may found a viable work around. I setup my form as add only. No deletes or editting. I then added two buttons. One for "Allow Deletes" and one for "Allow Edits". Each button sets there associated property to true, currently displays a warning about associated Table may become wrong and sets the focus to the first field. Also the important part I set a imode variable to which mode based on the command button they pressed. Now my code appears to know what mode I am in. Appears to work find for deletes. My edits needs a little bit more code to track what the old battery id was or plane ID if they edit one of them when deleting or changing a Flight record so I can update them correctly and the new ID's record. I don't mind after buttons because ensure the user is aware what they are doing.

    I really can't believe Access doesn't maintain a property for this as it is so important a lot of the time to keep things updated correctly. At least in the world of Bob.

    Thank for everybody's help.

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    What do you think that Status as Integer part means?? lol

    Try what you did in post 5, but instead of MsgBoxing the string "AfterDelConfirm", try MsgBox'ing the Status field!!


    0 = YES
    2 = NO
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Jul 2009
    Posts
    185
    That's what I am looking for. Where do I find such a item in the help files.

    Thank you very much.

    Is there a status I can check when editing vs adding?

  10. #10
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Where do I find such a item in the help files.
    Version 2000 still had decent help IIRC, so it should only be a matter of pressing F1 when the cursor is in the AfterDelConfirm property.

    Thank you very much.
    You're welcome

    Is there a status I can check when editing vs adding?
    No, but there is a BeforeInsert/AfterInsert procedure that you can differentiate between the two actions.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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