Solved

VB.Environ Can't find project or library

Posted on 2011-03-17
6
1,135 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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 - Access MVP)
DatabaseMX (Joe Anderson - Access MVP) 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now