13

In Visual Basic 6, when I attempt to access Project > References, it throws an error:

Error accessing system registry

I am:

  • Logged in as the local computer administrator
  • running Windows XP Professional and
  • I can execute regedt32.exe and access all the registry keys just fine.

VB6 was installed as the local administrator.

Any idea why this happens?


I'm running crystal reports 8.5 and it supposed to already have fixed that issue but apparently I still have the issue with 8.5 installed. I have also made the attempt of reinstalling crystal reports with no luck on the issue.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
phill
  • 13,434
  • 38
  • 105
  • 141

13 Answers13

22

Depending on the Windows OS you have (I have Windows 7 Enterprise), you might want to try giving administrator rights to the REGTLIB.EXE (located in C:\Windws). Right click on the REGTLIB.EXE file. Select Properties from the pop-up menu. Then select the Compatiblity tab. On the Compatiblity tab, check/select the Run this program as Administrator checkbox. Click OK to save your changes. It might take take care of the problem for you. It worked for me. Good luck.

Big Al
  • 221
  • 2
  • 3
  • 2
    How in the heck did you figure this out? I'm (sadly) building some VB6 code on a virgin Windows 7 x64 bit box with a MINIMUM vb6.exe install (I unchecked EVERY option). And got stuck and found this. I'd give you 20 up points if I could. VB6 sucks. COM sucks. This post was awesome. – granadaCoder May 09 '12 at 19:52
  • 1
    I can confirm that this one did the trick for me! The containing folder for me was C:\Windows\Microsoft.NET\Framework\v4.0.30319 – Luc Wollants Oct 29 '12 at 08:45
  • I think this occurs when VB6 is installed without being the Administrator. I first installed it without being Administrator and the installer didn't complain for me until I went to open a VB6 project in the IDE. However, after uninstalling and then installing again by selecting the `Run as administrator` option from the right click menu, I didn't get this error. – E-rich May 06 '13 at 18:43
13

For me this worked:

  1. goto C:\Program Files\Microsoft Visual Studio\VB98
  2. change the property of VB6.EXE by right click->Compatibility In privilege level section, check the option Run this program as Administrator
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
Raj
  • 131
  • 1
  • 2
  • I've tried all the answers and this solved my problem, thanks (I am running VB6 at windows 7 x64) – Amauri Mar 13 '17 at 18:44
  • Confirmed this worked for me on Win10 64bit. Funny thing is this has not been a problem until today (Monday)... It had no issues (other than being crappy vb6) all last week! I can't wait to be done with vb6/com! – Arvo Bowen Dec 04 '17 at 14:45
  • I used path C:\Program Files (x86)\Microsoft Visual Studio\VB98 & followed step 2 to solve the issue. – Sushil Jadhav Dec 13 '18 at 11:28
5

If you're running Office 2010 (Beta) Word (apparently) writes a restricted registry key. VB throws the error when scanning the registry. The key I have is:

HKCR\TypeLib\{00020905-0000-0000-C000-000000000046}\8.5

For Regmon - Filter for Process Name -> "vb6.exe" and Result -> ACCESS DENIED. Helps find it very quickly.

Fixed it with PSToosl (PSEXEC) to run registry editor. The command line is,

psexec -i -d -s c:\windows\regedit.exe

psexec needs to be run with elevated-permissions.


Edit by Jim: I'm on a Windows 7 (x64) box. Elevated permissions require the PSTools solution. XP can get away with a little less.

TAbdiukov
  • 1,185
  • 3
  • 12
  • 25
Jim Lang
  • 111
  • 2
  • 1
1

You could try Process Monitor to see which registry keys are accessed.

dummy
  • 4,256
  • 3
  • 25
  • 36
  • 1
    do you mean regmon? I tried that and everything seems to be ok. Maybe i'm just not using the filtering correctly. – phill Sep 20 '08 at 15:45
  • Yeah I meant regmon. Process Monitor bundles regmon, filemon and procmon into one app, but it is basically the same thing. You should see which Keys VB tries to access and if it was a success or a failure. Obviously you should look for failures. – dummy Sep 20 '08 at 18:13
1

I got this on a machine that I was using for VB6 development. I had been building a lot of COM DLLs from VB6 (without binary compatibility) and the cruft that had built up in the registry eventually got too much.

Have a look at what size the registry is and what limit you have set. I doubled the registry size and then went looking for a good registry hoover.

Hamish Smith
  • 8,153
  • 1
  • 34
  • 48
1

Here is a solution from Microsoft. It references the Crystal Reports problem, but the solution just uses regedit32 to walk the HKEY_CLASSES_ROOT\TypeLib and HKEY_CLASSES_ROOT\CLSID registry branches for dimmed keys and correcting the security on those keys. There are also instructions to fix the security if regedit32 is unable to access the key. Article ID: 269383

jac
  • 9,666
  • 2
  • 34
  • 63
1

In Windows 7 go to start menu then right click "Microsoft Visual Basic 6" then select properties and click Compatibility from the dialog box that appears then tick "Run this program as an administrator".

Rob Sedgwick
  • 4,342
  • 6
  • 50
  • 87
0

Have you tried this? Basically, it seems that it is a crystal reports issue. Hope that helps.

Matt Dawdy
  • 19,247
  • 18
  • 66
  • 91
0

Perhaps worth a try going to the "User Account Control Settings". Regards,

enter image description here

0

When I installed VB6 on Win7-64 (using instructions easily found by a search engine), it worked fine. UAC was off -- i.e. set to "never notify."

After a few weeks I turned UAC on -- i.e. set it to its default. VB6 then couldn't compile because of the "Error accessing the system registry" problem. Unfortunately, turning it off again didn't help. Apparently the damage done by turning it on was irreversible. I can't explain why this should be, but that's my experience.

Giving REGTLIB.EXE administrative privileges while leaving UAC off sounded like a great idea, but that didn't work for me either.

Finally, using Process Monitor and PsTools as described in other posts here worked. However, I had to give Full Control to large parts of my registry to Everyone. This didn't apply just to isolated keys. It seems that the compiler needs to add keys to major nodes, so I had to open up these entire nodes.

Aside from the fact that working through these steps took hours, I'm now much more exposed than I was before I tried to increase security via UAC, However, I need VB6 and don't see another solution short of a new computer.

Lesson: Don't use UAC with VB6. Except if you've arrived here it's too late for that.

Steve
  • 1
0

It's VB6 installation issue. Try to re-intall VB6 on your system. Otherwise open "visual studio 6.0" with "Run as Administrator". Then open/browse your project .vbp file via - New Project -> Existing tab.

Mike Szyndel
  • 10,461
  • 10
  • 47
  • 63
0

I have fixed the problem. But none of the suggestion above worked. What I did is giving everyone full control over the SYSTEM key in the registry. This creats a security break. I am running 64bit Windows 7 with vb6 serice pack 6B.

clemens
  • 16,716
  • 11
  • 50
  • 65
Zeus
  • 11
  • 2
0

I'm running Windows 10 Pro (10.0.16299 Build 16299) 64 bit. I was having this error when trying to compile a VB6 DLL.

I saw several answers in this post about running in compatibility mode as administrator. I thought I would first try just running in compatibility mode for Windows XP (sp2). I was able to compile my DLL after checking that box. I didn't need to run as administrator.

jbobbins
  • 1,221
  • 3
  • 15
  • 28