Unable to load MSRDO20.dll or RDOCURS.dll in VBA or VB6 applications

Migrating legacy applications written VBA or VB 6.0 to modern operating systems can frequently cause a headache.

Symptoms

I ran into one such instance with a FactoryTalk View SE Application that used VBA to connect to a SQL database. Data Access Objects (DAO) and ODBCDirect was used to create the ODBC connection and iterate over a Batch Client Cursor record set. The old application was running on Windows Server 2003 and I was porting it to Windows Server 2012 R2.

The following code was used:

    Set ODBCWorkSpace = CreateWorkspace("NewODBCWorkspace", "SQLUser","passw0rd!",dbUseODBC)
    ODBCWorkSpace.DefaultCursorDriver = dbUseClientBatchCursor

    strDBConn = "ODBC;Database = dbName;UID=SQLUser;PWD=passw0rd!;DSN=ODBCDSN"
    Set RecipeConn = ODBCWorkSpace.OpenConnection("", dbDriverNoPrompt, False, strDBConn)
    ODBCWorkSpace.DefaultCursorDriver = dbUseClientBatchCursor

    strSQL = "select * from Table"

    Set rstQuery = RecipeConn.OpenRecordset(strSQL, dbOpenDynamic, 0, dbOptimisticBatch)

When running it I received the following error:

This was due to not having Data Access Objects installed on the 2012 R2 server.

The next errors are below, they were caused by not having the appropriate DLL for the Batch Client cursor.

Resolution

  1. Download Service Pack 6 for Visual Basic 6.0 (Vs6sp6.exe)
    Service Pack 6 for Visual Basic 6.0
  2. Run Vs6sp6.exe and extract the files
  3. Open msrdo20.cab, it contains the following files: MSRDO20.DLL, MSRDO20.INF, and RDOCURS.DLL. Extract all three files and copy them to the C:\Windows\Sys64WOW\ directory.
  4. Open an elevated command prompt, navigate to C:\Windows\Sys64WOW, and register MSRDO20.DLL. The RDOCURS.DLL does not need to be registered.
    C:\Windows\System32> cd C:\Windows\Sys64WOW
    C:\Windows\Sys64WOW> regsvr32 MSRDO20.DLL