#define CRLF chr(13) + chr(10) local lnSelect, lnRows, lnCols, laFields[1], ; lcCategory, lcSubcategory, lcDept, llReturn, lnI lnSelect = select() && Save current alias with this lcCategory = .cCategory_Description lcSubcategory = .cSubcategory_Description lcDept = m.goApp.cDept ** Make sure we always have data even in the wrong case dimension .aRowSource [1, 3] .aRowSource [1,1] = "<<No data returned>>" store "" to .aRowSource [1, 2], .aRowSource [1, 3] if empty(.cCursorName) .cCursorName = "c_VisCodesLookup" endif if not empty(m.lcCategory) && no point to execute the code if Category is empty if (.lDisplayAllRecords and Get_Viscodes_Records_By_Category(m.lcCategory, m.lcSubcategory, ; m.lcDept, .cCursorName , .f.)) ; or Get_description_from_Viscodes(m.lcCategory, m.lcSubcategory, ; m.lcDept, .cCursorName , .f., .iSystemFlag) lnRows = reccount(.cCursorName) if m.lnRows > 0 && our cursor does have rows select (.cCursorName) lnCols = afields(laFields) dimension .aRowSource [m.lnRows, m.lnCols] copy to array .aRowSource select (m.lnSelect) ** This is going to execute assign method .lAddBlank = .lAddBlank .lAddAll = .lAddAll if .lAddAll or .lAddBlank if not empty(.controlsource) .listindex = 1 endif endif else =ErrorMsg("The control " + .name + " does not return records. " + CRLF + ; "Please, contact the system administrator") endif .AdjustWidth() else =ErrorMsg("The control " + .name + " is not set up correctly. " + CRLF + ; "Please, contact the system administrator") endif endif .rowsourcetype = 5 && Array .rowsource = "This.aRowSource" endwith