• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1308
  • Last Modified:

VB.Environ Can't find project or library

Hi. I am getting the following error in the Access VBA code below
"Can't find project or library"

    MYDOC_DIR = VBA.Environ("userprofile") & "\my documents"
 
0
Murray Brown
Asked:
Murray Brown
3 Solutions
 
Kelvin SparksCommented:
Try MYDOC_DIR = Environ("userprofile") & "\my documents"
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
already tried that. Put the VBA on originally and the error went away
0
 
Jeffrey CoachmanMIS LiasonCommented:
FWIW remember that many users/network admins will change the name and/or location of the My Documents folder.

So you may not want to Hardcode this...
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
JezWaltersCommented:
It might be worth decompiling the database (taking a backup first) by running the following command:

    msaccess /decompile "<insert the full path to your database here>"

... and then recompiling the database again.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
This is what I get on my system:

?VBA.Environ("userprofile")
C:\Documents and Settings\Administrator

mx
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
thanks for the help
0
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.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now