JMongi
Active member
- Local time
- Today, 18:33
- Joined
- Jan 6, 2021
- Messages
- 802
Here is the scenario. I got some query export to spreadsheet code working (see my other thread...lol). I ran it half a dozen times without issue. For half a second I got it into my head to turn the main code itself into a standalone sub so it can be called and used to export a variety of list queries we would be using. Long story short, I got some errors and decided the cost/benefit analysis didn't work.
So, I wasn't terribly smart and didn't save off a copy of my working code/db before trying to move it from a button call to a module. This may be irrelevant but I'm providing background just in case it is. One of the errors that occurred was an Error 70 - Permission Denied after creating an archive of the existing list (copying to a separate folder) and trying to delete the current list in preparation for generating a new list. This code worked fine pre tweaking. I throw in the towel, move my code back to the way it was. STILL get the same permission error. Look through my code, step through it. Can't see why it would be giving me a permission error. Check folder permissions, file permissions, etc, no issues stand out. I finally decide it has to be a file issue that I can't figure out. I manually delete the current list. Rerun the code and voila! No permission error. I've rerun the code again a handful of times and the delete now functions just fine.
That was a long way of asking, what gives? Any ideas on what I did or what happened that caused there to be a file that was unable to be deleted by Access?
Edit: To throw a possible start to a direction of a conversation. Did my putting some of this fso object in a PUBLIC module sub do something slightly different or necessitate a more specific closing of an instance (that's not in my code) that is handled when the code is in a PRIVATE button click sub?
So, I wasn't terribly smart and didn't save off a copy of my working code/db before trying to move it from a button call to a module. This may be irrelevant but I'm providing background just in case it is. One of the errors that occurred was an Error 70 - Permission Denied after creating an archive of the existing list (copying to a separate folder) and trying to delete the current list in preparation for generating a new list. This code worked fine pre tweaking. I throw in the towel, move my code back to the way it was. STILL get the same permission error. Look through my code, step through it. Can't see why it would be giving me a permission error. Check folder permissions, file permissions, etc, no issues stand out. I finally decide it has to be a file issue that I can't figure out. I manually delete the current list. Rerun the code and voila! No permission error. I've rerun the code again a handful of times and the delete now functions just fine.
That was a long way of asking, what gives? Any ideas on what I did or what happened that caused there to be a file that was unable to be deleted by Access?
Edit: To throw a possible start to a direction of a conversation. Did my putting some of this fso object in a PUBLIC module sub do something slightly different or necessitate a more specific closing of an instance (that's not in my code) that is handled when the code is in a PRIVATE button click sub?
Last edited: