Is This Content Helpful?
We're glad to know this article was helpful.
This error occurs when using geocoding functionality in a standalone application:
Run-time error '-2147467259 (80004005)'
The error message usually includes a library name.
The application cannot find the most recent version of mtch.dll in the system path.
The mtch.dll library is not a COM library; thus, it is not in the Windows registry. The geocoding functionality in ArcGIS uses this library, and it uses the PATH environment variable to find this library on your local hard disk. If your PATH environment variable does not include the path to the ArcGIS installation directory (for example, "c:\arcgis\arcexe81\bin"), your standalone application will not be able to find the mtch.dll library.
Also, if you have installed other ESRI products that use older versions of mtch.dll, such as ArcView GIS, MapObjects, or ArcIMS, your PATH environment variable may contain a path that includes an older version of mtch.dll. If one of these directories occurs in the PATH environment variable before the path to your ArcGIS installation directory, your standalone application will attempt to use an older version of mtch.dll.
To eliminate this problem, verify that the standalone applications can find the most recent version of mtch.dll. Insert the path of the ArcGIS installation directory at the beginning of the PATH environment variable by one of the following:
Warning: The instructions below include making changes to essential parts of your operating system. It is recommended that you backup your operating system and files, including the registry, before proceeding. Consult with a qualified computer systems professional, if necessary. Esri cannot guarantee results from incorrect modifications while following these instructions; therefore, use caution and proceed at your own risk.
Code: Private Const HKEY_LOCAL_MACHINE = &H80000002 Private Const KEY_QUERY_VALUE = &H1 Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" _ (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, _ ByVal samDesired As Long, phkResult As Long) As Long Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" _ (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, _ lpData As Any, lpcbData As Long) As Long '+++ Note that if you declare the lpData parameter as String, you must pass it By Value. Private Declare Function SetEnvironmentVariable Lib "kernel32" Alias "SetEnvironmentVariableA" _ (ByVal lpName As String, ByVal lpValue As String) As Long Private Sub SetLocalPath() Const BIN_DIR = "\bin" Const SUBKEY = "SOFTWARE\ESRI\ArcInfo\Desktop\8.0" Const VALUE_NAME = "InstallDir" Dim lngHKeyResult As Long Dim lngPCBData As Long Dim lngReserved As Long Dim lngType As Long Dim strArcGISInstallDir As String Dim strNewPath As String '+++ open the registry key containing the ArcGIS installation directory Debug.Print RegOpenKeyEx(HKEY_LOCAL_MACHINE, SUBKEY, 0, KEY_QUERY_VALUE, lngHKeyResult) '+++ get the size of the registry value Debug.Print RegQueryValueEx(lngHKeyResult, VALUE_NAME, lngReserved, lngType, _ ByVal strArcGISInstallDir, lngPCBData) '+++ initialize the string to the correct size strArcGISInstallDir = String(lngPCBData, vbNullChar) '+++ retrieve the registry value Debug.Print RegQueryValueEx(lngHKeyResult, VALUE_NAME, lngReserved, lngType, _ ByVal strArcGISInstallDir, lngPCBData) '+++ construct the new PATH environment variable strNewPath = Left(strArcGISInstallDir, lngPCBData - 1) & BIN_DIR & ";" & Environ("PATH") '+++ set the PATH environment variable Debug.Print SetEnvironmentVariable("PATH", strNewPath) End SubYour application should call the SetLocalPath procedure when it starts up, before accessing any geocoding functionality.