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?
vmccuneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
have you tried placing the application in a trusted location?
0
vmccuneAuthor Commented:
Yes.  I have my entire "C" drive as a trusted location and also included sub directories.
0
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...
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

Jeffrey CoachmanMIS LiasonCommented:
I see FileLen() as a Visual Studio function, ...so I am not sure how, or if, you can use it in Access...

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


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

FileLen is a VBA function as well: http://office.microsoft.com/en-us/access-help/filelen-function-HA001228837.aspx

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.
0
Jeffrey CoachmanMIS LiasonCommented:
<FileLen is a VBA function as well:>
Ya learn something new everyday...
;-)
0
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.
0
Scott McDaniel (Microsoft Access MVP - EE MVE )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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.