Microsoft KB Archive/35715

From BetaArchive Wiki
Knowledge Base

Multiple "Can't Find: <file>" Prompts on Write-Protected Disk

Article ID: 35715

Article Last Modified on 11/21/2006

This article was previously published under Q35715


If an OPEN "filename" statement (with no explicit path) in a Macintosh QuickBASIC program cannot find a data file in the current default folder, it will prompt you to look for the data file with the following statement:

"Can't find: <file>. Would you like to look for it?"

You can then click OK, change to the right folder, and open the needed file. The program now permanently remembers this new default folder. The next time that program OPENs a file, it looks in the new default folder.

However, if you run the program on a locked (write-protected) disk, the program cannot remember where you found the last file, and the "Can't find..." dialog always appears when your program attempts to OPEN a data file (with no explicit path) that is not in the current folder.

You can make the program automatically remember where you last found an OPENed data file by unlocking the floppy disk (by sliding the write-enable tab to close the hole).


In interpreted programs, the current folder defaults to the folder where QuickBASIC itself is running. In compiled programs, the current folder defaults to the folder where the compiled application is running.

You can use the CHDIR statement to change the current folder to the location of the data file(s). For example, CHDIR "Volume:Folder1:" makes all subsequent OPEN "filename" statements look in the folder called "folder1" on the disk volume called "Volume".

Note: You can also specify full pathnames for data files (such as OPEN "Volume:folder1:filexxx"). Two disadvantages of this are that your program will not be able to find the file if it is moved somewhere else, and the new folder won't be remembered if found through the "Can't Find File" dialog.

You may find it more flexible to use OPEN statements without an explicit path, such as OPEN "filename". Statements of this form use the default search path, and can remember a new path when run on write-enabled disks.

When you find an OPENed data file in response to the "Can't Find: <file>" dialog, the location and the filename are automatically saved in an MBPN resource in the source file or compiled program only if the program is on a disk that is not write-protected or locked. The next time the program OPENs the data file, it uses the remembered location that was stored in its MBPN resource. Programs run on write-enabled disks need to prompt you only once to find files that haven't been found before.

If a program is run on a disk that is locked, or the program itself is locked, it cannot save an MBPN resource and, therefore, prompts you to look for data files that are not in the current folder at every OPEN statement. This is inconvenient, but harmless.

You may disable the "Can't Find..." processing by selecting the "Disable File Not Found Dialog" option in the Options... from the QuickBASIC Run menu. If this option is selected, then a run-time error "53, File Not Found", occurs on the OPEN when a file cannot be found in the current folder or with the specified full path. This applies to both interpreted and compiled QuickBASIC programs.

Additional query words: MQuickB

Keywords: KB35715