Runtime error "Cannot find this file. Verify the path and file name is correct"

gmatriix

Registered User.
Local time
Today, 11:15
Joined
Mar 19, 2007
Messages
365
Hello All,

I have been having this annoying problem when my code run at night on my VDI machine.

I believe when the machine goes to sleep the path to the drive is disconnected. So when it wakes up to run the code, I get this error.

I can log into the computer and run it just fine. Everything connects and runs great but at night I think the path is not available.

Any work arounds for this? Is there someway to wake up the drive before it runs?

Part of code
DoCmd.SetWarnings False Dim FilNam1 As String 'Production FilNam1 = "\\BlaseyBlasey" & ".csv" DoCmd.TransferText acExportDelim, , "Output-No Dups", FilNam1, True

Any Idea?

Thanks again!
 

Attachments

  • Automate Error.PNG
    Automate Error.PNG
    4.8 KB · Views: 152
Hello All,

I have been having this annoying problem when my code run at night on my VDI machine.

I believe when the machine goes to sleep the path to the drive is disconnected. So when it wakes up to run the code, I get this error.

I can log into the computer and run it just fine. Everything connects and runs great but at night I think the path is not available.

Any work arounds for this? Is there someway to wake up the drive before it runs?

Part of code
DoCmd.SetWarnings False Dim FilNam1 As String 'Production FilNam1 = "\\BlaseyBlasey" & ".csv" DoCmd.TransferText acExportDelim, , "Output-No Dups", FilNam1, True

Any Idea?

Thanks again!
> FilNam1 = "\\BlaseyBlasey" & ".csv"
This is not a valid filename.
UNC filenames take the form of \\servername\sharename\filename.ext
 
I have added code to intermittently check that certain drives remain visible.

I tend to check the drives when opening any form, just in case the folder is no longer accessible. I have a table with the folders I need to check. (Eg O:, P:, and R: )
 
As another suggestion, you have .SetWarnings set to False, but I believe you want warnings to be True while debugging code. You got an error when the file system barfed, but it always helps to see if any other errors had popped up first.
 
> FilNam1 = "\\BlaseyBlasey" & ".csv"
This is not a valid filename.
UNC filenames take the form of \\servername\sharename\filename.ext
Thanks, I took out the real file name....this is just for example purposes
 
I have added code to intermittently check that certain drives remain visible.

I tend to check the drives when opening any form, just in case the folder is no longer accessible. I have a table with the folders I need to check. (Eg O:, P:, and R: )
yes I thought about that but once you check the drive....and say it is not available ....I can just end the code....but I want it to run....I guess what I need to do is keep the drive alive somehow
 
Don't let the PC sleep??
Yes indeed....I have went into the setting and the PC is not supposed to go to sleep but somehow the drive sleeps or disconnects until I click or it or something........I prob won't get up a 3 in the morning to click on the drive to make sure its alive....lol😆
 
As another suggestion, you have .SetWarnings set to False, but I believe you want warnings to be True while debugging code. You got an error when the file system barfed, but it always helps to see if any other errors had popped up first.
Thanks,

Yes I do that if there is a error I need to see.
 
There are two separate settings. one for the monitor and the other for the hard drive.
 
I am going to check but I thought I got that one....just a sec
Ok....

The hardisk is set to go to sleep after 0 mins and set to go to sleep on "Never"

I did notice something interesting tho......the "link state power management was on Med power saving mode" I am wondering if this is causing my link to go to sleep when it is not being used....I turned it to "off".....I will see what happens

Thanks for the tip...(y)
 
yes I thought about that but once you check the drive....and say it is not available ....I can just end the code....but I want it to run....I guess what I need to do is keep the drive alive somehow
Well I just tell the user there is a problem, and don't open the form. They have to sort it with their IT support, as it's not really an access/database issue.

Maybe there is some management policy running that doesn't work correctly and causes connections to drop. One of my clients had that problem, which looked like a database issue, but wasn't.
 
IF you have enough of your system up to have code run into an error, then do a sanity check using the File System Object. Here is a link to help you get a "Drive Object" including a code sample - and the list of drive properties in this link are testable so that you determine ahead of time that the drive is still there, is ready for use, etc.


This might be enough to at least mitigate the error even if you can't actually proceed. You could help make it a soft landing rather than a crash.
 

Users who are viewing this thread

Back
Top Bottom