|
Hi John, Beats me. The code that I got to work does things a little differently. Hope it helps. Steve Richter Private mConn As ADODB.Connection Private mIdxConn As AD400.Connection Private mIdx As AD400.Index Private mCmd As ADODB.Command Private mRcdSet As ADODB.Recordset Dim Rcds As Variant Dim Parms As Variant 'open the AD400.Connection, then OpenIndex the AD400.Index Set mIdxConn = New AD400.Connection mIdxConn.Open msSourceSystem, "", "" Set mIdx = mIdxConn.OpenIndex(msLibName + "." + msFileName, _ msLibName + "." + msFileName) 'Open the ADODB.Connection Set mConn = New ADODB.Connection sOpenCmds = "Provider=" + msProvider + ";Data source=" + _ msSourceSystem + ";" mConn.Open sOpenCmds, "", "" 'Use ADODB.Command.Execute to open the file thru the ADODB.Connection '( I have no idea why ) Set mCmd = New ADODB.Command Set mCmd.ActiveConnection = mConn mCmd.Properties("Updatability") = DBPROPVAL_UP_INSERT + _ DBPROPVAL_UP_DELETE + _ DBPROPVAL_UP_CHANGE mCmd.CommandText = "/QSYS.LIB/" + msLibName + ".LIB/" + msFileName + _ ".FILE(*FIRST, *NONE)" mCmd.Parameters.Append mCmd.CreateParameter("P1", adChar, adParamInput, 1) 'Execute the whatever cmd, get back a reference to an ADODB.Recordset Set mRcdSet = mCmd.Execute(Rcds, Parms, adCmdTable) -----Original Message----- From: midrange-l-admin@midrange.com [mailto:midrange-l-admin@midrange.com]On Behalf Of John Taylor Sent: Friday, February 15, 2002 5:02 PM To: midrange-l@midrange.com Subject: Error using DA400 object in VB Have any of you VB programmers run across the following error: ------------------------------------ Run-time error: "-2147217887 (80040e21)" Method 'OpenIndex' of object 'AD400Connection3' failed. ------------------------------------ Here is the relevent code: 'Setup connections Private m_cn As ADODB.Connection Private m_ix As AD400.Connection 'Setup access to the Vendor Master by key Private m_cmInp26 As New ADODB.Command Private m_ixInp26 As New AD400.Index Private Sub Class_Initialize() Dim t As CDbTable Set m_cn = gADO.getConnection Set m_ix = gADO.getIndexConnection Set m_cmInp26.ActiveConnection = m_cn m_cmInp26.Properties("Updatability") = 0 Set t = gTableDict.Item("INP26") m_cmInp26.CommandText = t.GetIfsName m_cmInp26.Parameters.Append m_cmInp26.CreateParameter("P1", adChar, adParamInput, 1) Set m_ixInp26 = m_ix.OpenIndex(t.GetIfsName, t.GetIfsName) End Sub The error is raised on the last line of the procedure: "Set m_ixInp26....". The value of "t.GetIfsName" is "/QSYS.LIB/MYLIB.LIB/MYFILE.FILE(*FIRST, *NONE)". The file does exist, and does have a unique key. The workstation is W2K/Sp2 with CAE 510/Sp SI02795. Regards, John Taylor _______________________________________________ This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l or email: MIDRANGE-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.