*---------------------- Location Section ------------------------ * Library: Acustomcontrols.vcx * Class: Cboviscodes * Method: Initialize() *----------------------- Usage Section -------------------------- *) Description: *) * Scope: Public * Parameters: *$ Usage: *$ * Returns: *--------------------- Maintenance Section ---------------------- * Change Log: * CREATED 11/02/2005 - WGB * MODIFIED *---------------------------------------------------------------- #define CRLF chr(13) + chr(10) local lnSelect, lnRows, lnCols, laFields[1] 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., .lSystemFlag) 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) if .lAddBlank dimension .aRowSource[ALEN(.aRowSource,1)+1, m.lnCols] && add one more row ains(.aRowSource,1) && inserts a row for lnI =1 to m.lnCols store space(1) to .aRowSource [1, m.lnI] next endif if .lAddAll dimension .aRowSource[ALEN(.aRowSource,1)+1, m.lnCols] && add one more row ains(.aRowSource,1) for lnI =1 to m.lnCols store iif(m.lnI = 1, "<<All>>", "%") to .aRowSource [1, m.lnI] next endif if .lAddAll or .lAddBlank .listindex = 1 endif else =ErrorMsg("The control " + .name + " does not return records. " + CRLF + ; "Please, contact the system administrator") endif if not .lSaveCursor use in select(.cCursorName) 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" endwithDo you see what is wrong here? The controlsource for the combo is set in the property sheet. If I try to set it after Init, it usually resolves the problem.