Avatar of Wayne Hayes
Wayne Hayes
Flag for Australia

asked on 

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

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?

Microsoft OfficeMicrosoft 365Microsoft AccessVisual Basic Classic

Avatar of undefined
Last Comment
Daniel Pineault

8/22/2022 - Mon