Hi,
Very new to ACCESS and trying to create a command to delete records simultaneously from multiple tables I fund some code which works but it deletes all records
Private Sub Command98_Click()
DoCmd.RunSQL "DELETE * from Associated_Process_table"
DoEvents
DoCmd.RunSQL "DELETE * from comments_table"
DoEvents
DoCmd.RunSQL "DELETE * from customer_table"
DoEvents
DoCmd.RunSQL "DELETE * from group_email_address_table"
DoEvents
DoCmd.RunSQL "DELETE * from task_table"
DoEvents
DoCmd.RunSQL "DELETE * from team_table"
DoEvents
DoCmd.RunSQL "DELETE * from main_table"
DoEvents
End Sub
I only want it to delete the current record - i.e the one I am viewing so I tried to amend it as follows:
Private Sub Command98_Click()
DoCmd.RunSQL "DELETE CurrentRecord * from Associated_Process_table"
DoEvents
DoCmd.RunSQL "DELETE CurrentRecord * from comments_table"
DoEvents
DoCmd.RunSQL "DELETE CurrentRecord * from customer_table"
DoEvents
DoCmd.RunSQL "DELETE CurrentRecord * from group_email_address_table"
DoEvents
DoCmd.RunSQL "DELETE CurrentRecord * from task_table"
DoEvents
DoCmd.RunSQL "DELETE CurrentRecord * from team_table"
DoEvents
DoCmd.RunSQL "DELETE CurrentRecord * from main_table"
DoEvents
End Sub
but now I get the Syntax error (missing operator) in query expression 'CurrentRecord'
what is missing in my code and can I rectify this to make it work for what I need?
Thanks
Jen