See attached accdb files
In Form1 Key Preview is set to YES
When you press the ESC key the application exits.
However if you click on Button1 the ESC key does not work anymore.
Button1 just does
DoCmd.TransferDatabase acLink, "Microsoft Access", "c:/Test1/BackEnd.accdb", acTable, "Table1", "Table1"
DoCmd.DeleteObject acTable, "Table1"