So you're creating (via a maketable query, I assume) a copy of a table that
is used as the source of choices (tableY) and then use that to get the final
choices for an order. You copy data from the tableY to tableZ via an append
query, I assume? And then you use a DeleteObject macro to delete tableY?
tableY is being created on the user's PC, so it is not shared by other
users, right?
So let me suggest a way that you can make this work without having to delete
and create tableY, and thus avoid the need for the VBA function that you'd
otherwise need.
Use this type of process.
Create tableY and never delete it. Instead, in your macro that currently
creates tableY, use a condition that gets the current record count in tableY
via a DCount function. If the DCount function returns a value equal to zero,
then tableY is empty and needs to be filled with data from tableX. Use an
append query to copy tableX into tableY, and then open your form.
However, if the DCount function returns any value other than zero (<>0),
then tableY has data in it and no appending of data is needed. Just open the
form.
The macro action would be something like this:
Condition: DCount("*", "tableY") = 0
Action: OpenQuery
Query Name: NameOfQueryToAppendTableXToTableY
Condition: < blank >
Action: OpenForm
Form Name: NameOfFormBoundToTableY
Then, after you copy the choices from tableY into tableZ, run a delete query
that deletes all records from tableY and makes it empty again, ready for the
next cycle.
This eliminates the need to delete, create, and test for existence of
tableY.