[AccessD] RunCommand acCmdDeleteRecord deleted data in from JOINed tables?

Stuart McLachlan stuart at lexacorp.com.pg
Tue Sep 21 15:37:38 CDT 2021


I had a similar situation bite me recently. 
A form based on a  multiple table query.
Deleting a record by selecting it and hitting "Delete" on the keyboard deleted related 
records.

I ended up making the form "AllowDeletions" = False and displaying a Delete button with 
code behind it to do:
CurrentDB.Execute"Delete * from tblPrimryName whenre PrimaryTablePK - " & 
PrimaryNamePK




On 21 Sep 2021 at 12:12, Ryan W wrote:

> I have a form, Checklist, it's RecordSource WAS WorkOrderChecklist.
> 
> I then attempted to join WorkOrderCheckList with WorkOrder for the
> datasource to get data about the workorder to display on the Checklist
> form.
> 
> the ribbon has a button "delete"0 that calls a function and sets the
> form / control in focus and runs:
> 
> DoCmd.RunCommand acCmdSelectRecord
> DoCmd.RunCommand acCmdDeleteRecord
> 
> In doing so, not only is the data in WorkOrderChecklist gone but the
> WorkOrder table itself (OOPS).
> 
> Is this expected behavior?  I might have to tweak my delete button in
> the ribbon to target the table instead of the selected record if
> that's the case.
> 
> 
> I found this blog post that more or less illustrates a similar issue:
> https://vip.halderconsulting.com/index.php/knowledgebase/8/acCmdDelete
> Record---unintended-problems.html -- AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd Website:
> http://www.databaseadvisors.com
> 




More information about the AccessD mailing list