Filelen returns undefined function

I have an application that when I try and fine the size of a picture file I get the FileLen "Undefined Function in Expression" message.  I have seen the option to modify the registry for sandbox mode and that does work.  HOWEVER, there has got to be a better way than this.

Does anyone know a what the better way is?
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
Try specifically defining a single folder as a Trusted Location, then place your database in that folder and see if the same thing happens.

If it does, then you've got issues with either Windows or Office. The only real fix for that is repair or reinstall.

If it does not, and you can then run the app normally, then check the Trusted Locations to insure they are setup correctly. And again, these are the Trusted Locations you set within Office programs, not Internet Explorer or Windows Explorer Trusted locations/sites.
Rey Obrero (Capricorn1)Commented:
have you tried placing the application in a trusted location?
vmccuneAuthor Commented:
Yes.  I have my entire "C" drive as a trusted location and also included sub directories.
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

Jeffrey CoachmanMIS LiasonCommented:
Then post the entire code for us to take a look at.

FileLen() is not a default function in Access, so make sure you have the appropriate library loaded as a reference in your vba editor...
Jeffrey CoachmanMIS LiasonCommented:
I see FileLen() as a Visual Studio function, I am not sure how, or if, you can use it in Access...

Perhaps capricon1 can steer you in the right direction...

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:

FileLen is a VBA function as well:

vmccune: Does this occur on all databases, or just on one? To test, try creating a new database with a single form, with a single button, and add this code to the Click event:

Msgbox FileLen("SomePathToAFile")

Then click the button. Do you see the Msgbox?

If you do NOT see the Msgbox, or if you continue to receive the message, then do as cap said previously - be sure that you've set the folder as a Trusted Location IN OFFICE (not IE). If you've done that, and you still have issues, then try using a different function (like Len, for example) and see if you still get the error. If you do, then you are probably facing a repair or reinstall of Office, or perhaps of Windows.

If you do, then I'd suspect that you have issues with the original database. Try these steps (make a backup first):

1. Compact the database
2. Compile the database - from the vba editor, click Debug - Compile. Fix any errors, and continue doing this until the menu item is disabled.
3. Compact again

You might also Decompile the database. To do that, create a shortcut, and set this as the target

"full path to msaccess.exe" "full path to your db" /decompile

Run this, then Compile your code again (as above) and compact.

Finally, you might also create a new, blank db and import everything to that new db. You can do this using the External Data - Access ribbon item.
Jeffrey CoachmanMIS LiasonCommented:
<FileLen is a VBA function as well:>
Ya learn something new everyday...
vmccuneAuthor Commented:
No changes.  This happens on multiple databases.  Once I go to the registry and change the sandbox method, it works perfectly.  I don't think it is the application as much as there doesn't seem to be a way other than regedit to solve the problem.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.