Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2004
    Location
    Hong Kong
    Posts
    29

    Unanswered: OnDelete event not function properly

    Hi

    I am writing an ACCESS programme. There is a form with a child table attached. There is an Amount field in the child table, I would like to calculate the SUM UP value of that Amount field using the DSum function. I encounter a problem that if I delete a record, the sum value of the DSum function seems to be not functioning properly. I use the OnDelete event function to trigger the code with the DSum function. Could Any body help?

    regards,

    CChan

  2. #2
    Join Date
    Apr 2002
    Location
    Illinois
    Posts
    133
    CChan,

    It would help to know more details about how the DSum function is malfunctioning. One thing to consider is that the OnDelete event may be triggering before the record is actually deleted, thus running the DSum function before the deletion occurs. This will give you and incorrect sum.
    SteveH

  3. #3
    Join Date
    Mar 2004
    Location
    Hong Kong
    Posts
    29

    OnDelete Function

    Thanks for SteveH

    Is there any other event that I can trigger so that it actually takes into account the records are deleted.

    regards,

    CChan

  4. #4
    Join Date
    Jun 2004
    Posts
    96
    u can try the AfterDelConfirm event.. this is triggered when you confirm to delete a record.

    Cyherus

  5. #5
    Join Date
    Mar 2004
    Location
    Hong Kong
    Posts
    29
    I tried to use the AfterDelConfirm Event to trigger the SUM UP functions. However, it seems not to work properly either. Besides, there is no prompt for confirmation when I delete a record.

    regards,

    CChan

  6. #6
    Join Date
    Jun 2004
    Posts
    96
    AfterDelConfirm is only triggered if you react (yes/no) to the confirm delete dialog box that prompts when you deleted a record.

    Are you deleting records using codes?
    you are using the child table's AfterDelConfirm event right?

    Cyherus

  7. #7
    Join Date
    Mar 2004
    Location
    Hong Kong
    Posts
    29
    Thanks for answering my question.

    I did try to put the SUM UP function in the AfterDelConfirm function. However, the event was not triggered , I know because I put the breakpoint in the AfterDelConfirm function and it didn't run the AfterDelConfirm event function. Besides, there wasn't any Dialog box for confirmation to delete record. Should I be doing something in order to trigger the dialog box.

    For your information, I didn't delete the record using code, I deleted the record manually.

    regards,

    CChan

  8. #8
    Join Date
    Jun 2004
    Posts
    96
    the dialog box automatically prompts whenever a record is to be deleted, eg: "You are about to delete one or more records. blah blah blah..."

    did you turn off MS Office warnings during any part of the program?
    and just a stab in the dark, did you link the form's event to the code?
    YourForm --> Properties --> Events --< After Delete Confirm = [Event Procedure]

    maybe u can try to post ur db?

    Cyherus

Posting Permissions

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