ave populus
sto cercando di accedere ad un db as400 da excel sfruttando ADO ed una connessione ODBC DSN-less
il codice che ho prodotto a codesco scopo č il seguente:
codice:
Dim conn As Connection, CellaAtt As Range
Set conn = CreateObject("ADODB.connection")
Dim str As String
Set str = "Driver=iSeries Access ODBC Driver; Server=192.168.xxx.xxx;
Uid=xxx; Pwd=xxx; System=s44a3312;"
conn.Open str
Dim rs As Recordset, sql As String
Set sql = "SELECT CPCO,CUMV, QGF2RXG from MERSY_DB.RXGIGI0F
where cart=1618 and carv=1 AND TAAD=2005 AND
TMMI=7 AND TGGM=8"
Set rs = CreateObject("ADODB.Recordset")
rs.Open conn, sql
i = 1
Set CellaAtt = ActiveCell
CellaAtt = "UNO"
CellaAtt.Offset(1, 0) = "DUE"
CellaAtt.Offset(2, 0) = "TRE"
Do While rs.EOF = False
i = i + 1
CellaAtt.Offset(0, i) = rs.Fields(0)
CellaAtt.Offset(1, i) = rs.Fields(1)
CellaAtt.Offset(2, i) = rs.Fields(2)
rs.movenext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
cosa c'č che non vā visto che se lo eseguo mi dice:
Errore di compilazione
Necessario oggetto
Premetto che di VBA non so 'na cippa