The table is being used by the report. That is why you cannot delete it. Move the code to a standalone function and run the function from the macro. I believe you will have to actually print the report rather than use print preview otherwise you'll still have the same problem. The print preview will be locking the table when the macro trys to delete it.
One alternative is to use a query as the recordsource for the report rather than a temp table. That way you don't have to worry about getting rid of the table. The recordset created by the query is not persistant and will be deleted when the query is closed.
A second alternative if you must use the temp table is to delete the table (if it exists) before you start, rather than at the end. This way you won't run into conflicts if you try to delete the temp table while it is still being used by the report.