troubleshooting Question

MSACCESS 2019 (16.0) Issue Writing to registry using advapi32.dll - Wrong Location

Avatar of Wayne Hayes
Wayne HayesFlag for Australia asked on
Microsoft OfficeMicrosoft 365Microsoft AccessVisual Basic Classic
12 Comments1 Solution76 ViewsLast Modified:
Have just upgraded from Office/Access 2013 to Office 2019 (32bit edition installed via Office 365) and existing VBA code related to writing a registry key is redirected to a new location.  Existing logic to read registry key (RegQueryValueExString) reads from the nominated registry key correctly.


Declare Function RegQueryValueExString Lib "advapi32.dll" Alias "RegQueryValueExA" _
    (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, _
    lpType As Long, ByVal lpData As String, lpcbData As Long) As Long

Declare Function RegSetValueExString Lib "advapi32.dll" Alias "RegSetValueExA" _
    (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _
    ByVal dwType As Long, ByVal lpValue As String, ByVal cbData As Long) As Long

Attempting to write to registry key:-
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\My Vendor Name\My Application Name\V01.1\Prod]

Actual location that is written:-
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software \My Vendor Name\My Application Name\V01.1\Prod]

Was only able to determine this by running MSACCESS in 'Admin' mode as kept received Error# 5 (ERROR_CANTWRITE) due to permission issues?

How can I force the registry write to the correct location?

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros