I am using Access 2003 and need to add a delete button to my membership form. I have a main form which also has a subform in it showing the payment record for the member selected in the main form. My form is also a ‘tab’ form with the family record in the tab behind the main form of entry.
I have ticked all the boxes to update, cascade etc in the relationships and these are all linked as they should be 1 to many etc.
Until recently everything worked ok but the last person who took over the data entry overwrote old members with new members details and ignored me when I said not to do this. So that meant the ‘new’ members ended up with family and payments records that belonged to the original old member. It has taken me forever restoring from an older backup version and then reinserting all the members over again. I always thought it was bad practise to ‘delete’ records but in hindsight had I put a delete button on my form at least the old members would have been deleted by the user rather than causing the complete chaos he has done to all my records. It has also made me aware that an inexperienced data entry clerk may make a mistake and cannot delete the mistake for instance if they enter a duplicate record. Anyway the point is simply that using the command button wizard I have added a delete button for record operations ‘delete record’ however this does not appear to work and does not delete the record I have in my form. I’ve searched for code snippets in VB which are practically the same and tried these but these don’t work either. What have I done wrong or rather not done?
My code is as follows
Private Sub CommandDelete_Click()
On Error GoTo Err_CommandDelete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_ CommandDelete_Click:
Exit Sub
Err_ CommandDelete_Click:
MsgBox Err.Description
Resume Exit_ CommandDelete_Click
End Sub