We help IT Professionals succeed at work.
Get Started

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

Last Modified: 2020-05-11
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?

Watch Question
President / Owner
Most Valuable Expert 2017
This problem has been solved!
Unlock 1 Answer and 12 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE