title: cannot connect with MS Access (.mdb file) with OLEDB
body: <p>I have a problem. I have to write an ABAP app that connect with MS Access (.mdb file) with OLEDB, but my code cannot connect. I've got SY-SUBRC = 2. How can I fix it? How can I check in MS Access what should be in <code>User ID=</code> in SQL?</p>
  
  <pre><code>INCLUDE ole2incl.
  
  DATA: con         TYPE ole2_object,
        rec         TYPE ole2_object.
  
  DATA SQL(1023).
  DATA: BEGIN OF SPL OCCURS 0,
  VAL(1023),
  END OF SPL.
  
  DATA: BEGIN OF I1 OCCURS 0,
  F1(10),
  F2 TYPE I,
  END OF I1.
  
  IF con-header IS INITIAL OR con-handle = -1.
    CREATE OBJECT con 'ADODB.Connection'.
    IF NOT sy-subrc = 0.
      EXIT.
    ENDIF.
    CREATE OBJECT REC 'ADODB.Recordset'.
    IF NOT sy-subrc = 0.
      EXIT.
    ENDIF.
  ENDIF.
  
  *MDB connetion infomations
  CONCATENATE 'Provider=' '''Microsoft.Jet.OLEDB.4.0''' ';'
  INTO SQL.
  CONCATENATE SQL 'Password=' '''platnikbcc''' ';'
  INTO SQL.
  CONCATENATE SQL 'User ID=' '''Admin''' ';'
  INTO SQL.
  CONCATENATE SQL 'Data Source=' '''D:\Platnik.mdb''' ';'
  INTO SQL.
  CONCATENATE SQL 'Mode=' '''Share Deny None'''
  INTO SQL.
  
  
  
  *MDB connection
  CALL METHOD OF CON 'Open'
  EXPORTING #1 = SQL.
  
  *Query run
  *SY-SUBRC still equals 0
  CALL METHOD OF REC 'Open'
  EXPORTING #1 = SQL
            #2 = CON
            #3 = '1'.
  *SY-SUBRC = 2 FROM HERE
  
  *Query (select) statement ...
  SQL = 'select * from UBEZP_IDENT'.
  
  *Query run
  CALL METHOD OF REC 'Open'
  EXPORTING #1 = SQL
            #2 = CON
            #3 = '1'.
  
  *Selecting MDB record into SAP internal table
  DO.
    CALL METHOD OF REC 'getstring' = SQL
    EXPORTING #1 = '2'  "Do not modify!
              #2 = 1    "Do not modify!
              #3 = '|'  "Do not modify!
              #4 = '|'. "Do not modify!
    IF sy-SUBRC EQ 0. 
      REFRESH SPL. CLEAR SPL.
      SPLIT SQL AT '|' INTO TABLE SPL.
      LOOP AT SPL.
        CASE SY-TABIX.
          WHEN 1.
            I1-F1 = SPL-VAL.
          WHEN OTHERS.
            I1-F2 = SPL-VAL.
        ENDCASE.
      ENDLOOP.
      APPEND I1. CLEAR I1.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  
  *Result writing...
  LOOP AT I1.
    WRITE: AT /1(10) I1-F1,
           AT (10) I1-F2.
  ENDLOOP.
  
  *Connetion close &amp; destroy
  FREE OBJECT con.
  FREE OBJECT rec.
  </code></pre>