Search code examples
vbaexcelibm-midrange

Send data to AS400 from VBA (runtime error 249)


I hope you can help me solving this problem

Every day a friend of mine has to fill the same field in AS400 using data that are stored in excel spreadsheet. I am pretty advanced programmer in VBA so I was wandering if there is a way to make vba and as400 interact

any ideas?

thank you very much in advance

EDIT: in the meanwhile I am doing some digging and I found this

http://www.ibm.com/support/knowledgecenter/SSEQ5Y_5.9.0/com.ibm.pcomm.doc/books/html/host_access08.htm

Dim autECLConnList as Object
Dim Num as Long

Set autECLConnList = CreateObject("PCOMM.autECLConnList")

autECLConnList.Refresh
Num = autECLConnList.Count

but when I try to exectu the following code I get runtime error 249 saying that ActiveX Component couldn't create the object


Solution

  • If you want to load data directly to the tables, than the ODBC, OLEDB, or .NET driver would be the way to go. In fact, IBM provides functions to transfer data directly to/from Excel.

    If you must load data through the existing screen, then you're on the right track. However, note that Personal Communications (PCOMM) is a stand-a-lone product different that the more prevalent Client Access (CA) product.

    It's a bit confusing as CA includes a a subset of PCOMM as the CA emulator.

    And there's two variants of CA - older IBM i Access for Windows (originally Client Access (CA) for Windows) - new Java based IBM i Access Client Solutions (ACS)

    The older CA product included APIs for enabling workstation programs to interact with IBM i host systems. You'll need to install the Programmer's Toolkit component of IBM i Access for Windows. The toolkit is basically just documentation. Included in the toolkit is a link to some sample applications

    Now the new ACS product is Java based. However IBM packages some windows specific components for ACS under the Windows Application Package. That apparently includes the aforementioned programmers toolkit.

    I'm honestly not sure how that works given that the ACS emulator is Java based, instead based on the native windows PCOMM like the older emulator was.