RunAs & MS Access 2000 database

M

Marius Strumyla

Here's what I'm doing. I'm switching to another domain user with
RunAs. Then open a simple Access database with one table. When I try
to open the table, I get "The Visual Basic for Applications project in
the database is corrupt."
The same table opens fine running as a regular user. For testing, I
created a new database with an empty table.

What's interesting is that I have one database and I can open any
table in it. The table was created with MS Access 2000 but probably
different service pack. So I copied the desired tables and queries
from the "bad" database to the "good" one. Opening tables was still
working. I removed all unnecessary tables, queries, forms, reports. It
was still working. I removed two Modules that were in the "good" db
and BANG... I then got the error "The Visual Basic for Applications
project in the database is corrupt."

I'm running MS Access 2000 SP-3 under Win2k. NT permissions are
exactly the same on both mdb files.

Any ideas?
 
A

Allen Browne

Did you compact the database after deleting the modules?

It might help to decompile, and then compact again. To decompile, enter
something like this at the command prompt while Access is not running. It is
all one line, and include the quotes:
"c:\Program Files\Microsoft office\office\msaccess.exe" /decompile
"c:\MyPath\MyDatabase.mdb"

If you have multiple versions of Access on your computer, it will need to
write the registry when you switch versions. Your Run As scenario may not
have adequate permissions to do that, so the right libraries are not loaded,
and it reports the VBA side is corrupt. This is a real issue under Vista, as
a result of the new UAC. Details:
Errors using multiple versions of Access under Vista
at:
http://allenbrowne.com/bug-17.html
 
M

Marius Strumyla

It might help to decompile, and then compact again. To decompile, enter
something like this at the command prompt while Access is not running. It is

Decompiling did "help". It is consistent now. Both of the databases
throw this error "The Visual Basic for Applications project in
the database is corrupt."

I fired Registry Monitor (Regmon.exe) and noticed that Access is
looking for HKU\.Default\Software\Microsoft\VBA\6.0 key in the
registry. This is expected as RunAs uses a default user profile. VBA
key is not there and msaccess.exe gets ACCESS DENIED.

It seems to me that running MS Access from RunAs is not supported. I
guess I will try to copy registry keys from my regular profile.
 
M

Marius Strumyla

I fired Registry Monitor (Regmon.exe) and noticed that Access is
looking for HKU\.Default\Software\Microsoft\VBA\6.0 key in the
registry. This is expected as RunAs uses a default user profile. VBA
key is not there and msaccess.exe gets ACCESS DENIED.

It seems to me that running MS Access from RunAs is not supported. I
guess I will try to copy registry keys from my regular profile.

It worked! I exported HKCU\Software\Microsoft\VBA\6.0 registry key,
changed path to start HKU\.Default\, and gave the domain user full
permissions to the key.
I can open all MS Access 2000 database from RunAs.

Thanks Allen for your suggestion.
 
A

Allen Browne

Just FYI, the number of registry keys Access writes is astounding. If you
install Access 2007 and retain your previous version, when you switch to
A2007, it writes much more than 10,000 registry keys.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top