Hi All
WinXPPro
Access 2002 SP3
I have a form in datasheet view that presents a list of records. When the user selects a record for deletion I also want to go away and delete a corresonding record in another (unbound) table . I want to test that the corresponding record has been deleted before deleting the datasheet record, in fact it's crucial.
I'm thinking:-
1. In the Keydown event:-
a) Check for the Delete Key.
b) Trap the selected rows in and store in a global variable (could you help with syntax here pls?).
2. In the AfterDelConfirm event:-
a) Loop around the above global variable and issue a db.Execute DELETE etc... for the current record's "corresponding" partner.
b) Somehow trap the result of the above DELETE ( dbFailOnError??) in VB.
c) If successful - Allow the delete to go ahead for the current record.
d) If unsuccessful - Exit the AfterDelConfirm so that the current datasheet record does not get deleted. Put out a msg to the user and log the error message.
Or can anyone recommend a bullet-proof method please? An example would be great if poss.
Thanks
WinXPPro
Access 2002 SP3
I have a form in datasheet view that presents a list of records. When the user selects a record for deletion I also want to go away and delete a corresonding record in another (unbound) table . I want to test that the corresponding record has been deleted before deleting the datasheet record, in fact it's crucial.
I'm thinking:-
1. In the Keydown event:-
a) Check for the Delete Key.
b) Trap the selected rows in and store in a global variable (could you help with syntax here pls?).
2. In the AfterDelConfirm event:-
a) Loop around the above global variable and issue a db.Execute DELETE etc... for the current record's "corresponding" partner.
b) Somehow trap the result of the above DELETE ( dbFailOnError??) in VB.
c) If successful - Allow the delete to go ahead for the current record.
d) If unsuccessful - Exit the AfterDelConfirm so that the current datasheet record does not get deleted. Put out a msg to the user and log the error message.
Or can anyone recommend a bullet-proof method please? An example would be great if poss.
Thanks