Solved

VB.Environ Can't find project or library

Posted on 2011-03-17
6
1,158 Views
Last Modified: 2012-06-21
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
Comment
Question by:murbro
6 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35155186
Try MYDOC_DIR = Environ("userprofile") & "\my documents"
0
 

Author Comment

by:murbro
ID: 35155218
already tried that. Put the VBA on originally and the error went away
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 167 total points
ID: 35156396
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 17

Assisted Solution

by:JezWalters
JezWalters earned 166 total points
ID: 35156397
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
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 167 total points
ID: 35159287
This is what I get on my system:

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

mx
0
 

Author Closing Comment

by:murbro
ID: 35166731
thanks for the help
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question