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?
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.
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.
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]