You can then replace an existing file with a newer version.
No, not if the file to be replaced is still open. If the file could be replaced, it could have been outright deleted.
@Papa_Bear1, there is a relatively simple experiment to try that would answer this question definitively. I'm assuming from your description of your process that the temp file is local to your PC. Which, if true, gives us a measurable artifact. (If I'm wrong, if the file is NOT on your PC when you use it, don't bother with the rest of this.)
Run your process up to but not including the point at which you would try to delete the file. However, DEFINITELY go
past the point where you
unlinked the file. If you know how to debug code, put a breakpoint to stop execution. You want it stopped or paused or debug/breakpointed at the point where you WOULD delete that file if you could - but you haven't YET tried that deletion. At that point, minimize Access.
With Access open but minimized (and not running anything on a timer or having some other process underway), start the Windows Task Manager. You can right-click the task bar for a long menu, or use CTRL-SHIFT-ESC, or use CTRL-ALT-DEL and select Task Manager from the resultant menu. Select the Performance Tab. Near the bottom of that screen, click on "Open Performance Monitor." You'll get a new multi-tabbed display. Select the "Disk" tab. (Be patient, you're almost there...)
You will see three horizontal divider bars with titles: "Processes with Disk Activity", "Disk Activity", and "Storage" What you want will be under "Disk Activity" (the center section.) You can use the mouse to "grab" the bars to make that center section taller (more entries). Now look at the column headers to find "File." Clicking in the header toggles between ascending and descending order of display sorted by file specification. You can also scroll through the list because there is a right-side scroll bar.
Scroll through that list looking for the name of the file that you just temporarily linked to. IF you find it in that list, it is open even if its statistics say 0 reads or writes at the moment. IF you cannot find the file then the experiment failed and the problem isn't that the file is open. HOWEVER, if you DO find it, we can go one step further. Once you have found the file in the disk activity list, look to the next column to the left, which will be PID (process ID). Note the PID number. Now look in the section "Processes with Disk Activity" to find the process with that PID. If it says "Access" then that is proof that Access is still holding onto the file (by having it still open).
If this test proves that Access still has the file open even though you have unlinked it, then the problem is that the handle has to be separately closed as previously discussed. Shouldn't take too long to test that, so let us know what happened.