'*********************** 'Process various lookups '*********************** Dim sReturnVariantMulti As Variant Dim lstTitleArray() As String Dim i As Integer Select Case iFieldIndex Case fiTitle 'Run Query against WebDocs lookup list table DOCL00 'using the iSeries Access ODBC database driver sReturnVariantMulti = RJSADODBMultipleRecordLookup("Driver={iSeries Access ODBC Driver};" & _ "SYSTEM=1.1.1.1;uid=user;pwd=password;", _ "select lvalue, lseqnbr " & _ "from library.file " & _ "where ldoctype = '" & sDocType & "'" & _ "and lkeyval = 'TITLE' " & _ "order by lseqnbr, lvalue", _ 100, _ rjsDisplayErrorsYes) 'Check for data in lookup table If sReturnVariantMulti(0, 0) = "DATAFOUND" Then Begin Dialog docTitle 400,231,"Select Title/Desc" ' %GRID:10,7,1,1 ListBox 10,7,380,189,lstTitleArray(),.lstTitle,1 OKButton 100,203,80,21 'standard OK button CancelButton 210,203,90,21 'standard Cancel button End Dialog Dim dlgDocTitle As docTitle ' Resize listbox contents array ReDim lstTitleArray(sReturnVariantMulti(0, 1)) ' Start out with nothing pre-selected dlgDocTitle.lstTitle = -1 ' Fill the list For i = LBound(lstTitleArray) To UBound(lstTitleArray) - 1 lstTitleArray(i) = sReturnVariantMulti(i + 1, 0) ' Pre-select matching item If sDocTitle = sReturnVariantMulti(i + 1, 0) Then dlgDocTitle.lstTitle = i End If Next i 'Set title to selected value if OK clicked Do While Dialog(dlgDocTitle) ' No selection If dlgDocTitle.lstTitle = -1 Then MsgBox "Please make a selection" Else lcarrFieldValues(fvTitle) = sReturnVariantMulti(dlgDocTitle.lstTitle + 1, 0) Exit Do End If Loop Else 'Display error messages MsgBox sReturnVariantMulti(0, 2) End If End Select
Still have questions? We can help. Submit a case to Technical Support.