G
G Lam
Hi, I make a form with subform that displays filtered records from two
tables (1 to many).
The user can edit the records in the many side in the subform. I also
included a Delete button to delete all the records in the subform. The codes
as following. I notice it takes a fraction of a second to delete the
records. Beside, by design, Access 2000 can only delete the many side
records in this manner, the record in the 1 side table is not deleted.
1. Is there a better way to do it?
2. How can I also delete the record in the table of the 1 side, with this
one click?
*****************************************************
Private Sub EditDelBox_Click()
On Error GoTo Err_EditDelBox_Click
Dim i As Integer
i = Forms!frmMainEdit!fsfrSubEdit.Form.RecordsetClone.RecordCount
Do Until i = 0
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Application.SetOption "Confirm Action Queries", False '
i = i - 1
Loop
Exit_EditDelBox_Click:
Exit Sub
Err_EditDelBox_Click:
MsgBox Err.Description
Resume Exit_EditDelBox_Click
End Sub
tables (1 to many).
The user can edit the records in the many side in the subform. I also
included a Delete button to delete all the records in the subform. The codes
as following. I notice it takes a fraction of a second to delete the
records. Beside, by design, Access 2000 can only delete the many side
records in this manner, the record in the 1 side table is not deleted.
1. Is there a better way to do it?
2. How can I also delete the record in the table of the 1 side, with this
one click?
*****************************************************
Private Sub EditDelBox_Click()
On Error GoTo Err_EditDelBox_Click
Dim i As Integer
i = Forms!frmMainEdit!fsfrSubEdit.Form.RecordsetClone.RecordCount
Do Until i = 0
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Application.SetOption "Confirm Action Queries", False '
i = i - 1
Loop
Exit_EditDelBox_Click:
Exit Sub
Err_EditDelBox_Click:
MsgBox Err.Description
Resume Exit_EditDelBox_Click
End Sub