davidakemp
New Member
- Joined
- Aug 1, 2007
- Messages
- 2
I'm trying to pull data from and IBM AS/400 into Excel. I have the iSeries toolbar and this works great but I want to be able to pull data within a VB Macro. I have tried the following code but have had no luck thus far:
Dim qt As QueryTable
sqlstring = "select MOMAST.ORDNO from AMFLIBS.MOMAST"
connstring = _
"ODBC;DSN=192.168.200.5-MXACS;UID=DKEMP;PWD=DKEMP;Database=AMFLIBS.MOMAST"
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
Destination:=Range("B1"), Sql:=sqlstring)
End With
In AS/400 DB2 terms, the database is AMFLIBS/MOMAST.
The field (Column) I would like to pull is ORDNO.
The DSN 192.168.200.5-MXACS is setup under User DSN.
What am I doing wrong?
Thanks
Dim qt As QueryTable
sqlstring = "select MOMAST.ORDNO from AMFLIBS.MOMAST"
connstring = _
"ODBC;DSN=192.168.200.5-MXACS;UID=DKEMP;PWD=DKEMP;Database=AMFLIBS.MOMAST"
With ActiveSheet.QueryTables.Add(Connection:=connstring, _
Destination:=Range("B1"), Sql:=sqlstring)
End With
In AS/400 DB2 terms, the database is AMFLIBS/MOMAST.
The field (Column) I would like to pull is ORDNO.
The DSN 192.168.200.5-MXACS is setup under User DSN.
What am I doing wrong?
Thanks