
I set up a run code step, enter the new function name (for example I change Command42_Click() to Test() and that is what I call) and then it returns an error. My problems begin when I try and call the newly developed Module in a macro. When I copy this code into a standalone module and run it, it also works.

This code works great in the Access form button and needs no edits. I have shortened the code for the sake of brevity, but the 'Data Download step is repeated for tables 2 - 8 as well. Public Sub Command42_Click()ĬurrentDb.Execute "INSERT INTO " & strLocalTable & " SELECT * FROM setup_PTQ"

The current sub reads something like the following. I am editing a project and trying to take a VBA function that is currently run by a button click on a form, and run it through a macro so I can then call it to run in Excel.
