Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 67 Too many files 1

Status
Not open for further replies.

dlpastel

Programmer
Aug 8, 2002
114
US
I have a program that gets very busy from time to time and when I try to do a FreeFile it says Error 67 Too many files. How do I get around this.
1. Do I add a files= statement to config.sys.
2. I do not have a config.sys. Do I create one in the root?
3. How can I find out how many files are open so I know what to set the value to.

Thanks,
Dan
 
You're hitting a VB limit ... not an OS limit. VB can have a maximum of 512 files open at once and that error message means that you're exceeding that value.

FreeFile will return either the next available file number or will raise an error (the one you are seeing) if you are trying to exceed 512.

You can access the file numbers 1-255 with

n = FreeFile

and the numbers from 256-512 with

n = FreeFile(1)

If you just use FreeFile without the parameter then you're restricted to 255.

You could try something like
Code:
On Error Resume Next
n = FreeFile
If Err.Number = 67 then
   Err.Clear
   n = FreeFile(1)
   If Err.Number = 67 Then
      MsgBox "More than 512 files in use"
   End If
End If
 
Have a star. Never knew that!

-David
2006 Microsoft Valueable Professional (MVP)
2006 Dell Certified System Professional (CSP)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top