I did a quick test...EXISTKEY does indeed seem to return 2 when it doesn't exist, not 0 whereas KEYEXIST returns 0. (at least on XP)

Sorry, I think I'm going down the wrong path here. Youre probably testing to ensure it's there, not that it's not there (so 0 is prob correct for existkey).

I would still suggest upgrading to the newer keyexist function as in the example below. Don't think it will fix your problem though. Do you know what error it is returning?
 Code:
;====================================================================
                ;
                ; CHANGE ODBC-SETTINGS FOR 32 BIT DATA SOURCES
                ;
                ;====================================================================
                ; OLD SQL Server 
                $OLDSERVER = "one"
                ; NEW SQL Server
                $NEWSERVER = "two"
                
                $MyKey="HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\nymeso32"
                IF KEYEXIST($MyKey)
                ; ---- only if data source exists and changes are not made ------
                $Server = READVALUE($MyKey, "Server")
                               IF $Server = $OLDSERVER
                               ; Name of SQL Server
                               $X = WRITEVALUE($MyKey, "Server", $NEWSERVER, "REG_SZ")
                               ENDIF
                ENDIF

; END SCRIPT FILES =====================================================


Edited by ShaneEP (2011-09-28 04:18 PM)