* Companies >select distinct company, compid ; > from companies ; > into cursor crsComps nofilter > >* Employee >* Assuming we don't want to restrict to employee of selected company >* Otherwise add a where clause like >* where employee.compid = crsComps.CompId >select distinct lastname-(', '+FirstName) as EmpName, empid ; > from employee ; > into cursor crsEmployee nofilter > >* Jobs with restrictriction to Company+Employee >select Job,JobExtra,JobId,CompId,EmpId ; > from Jobs ; > where Jobs.compid = crsComps.CompId ; > and jobs.EmpId = crsEmployee.EmpId ; > into cursor crsJobsNow all you need is to make these into listboxes :)
*lstCompany.init >with this > .Rowsourcetype = 3 > .RowSource = ; >[select distinct company, compid ]+; >[ from companies ]+; >[ into cursor crsComps nofilter] > .ColumnCount = 1 && Don't want to show id and no need to play with columnwidts >endwith > >* Gotfocus or some other place you want to refresh a listbox content >this.Requery() && For comapny we don't need this but using as a template >this.ListIndex = 0 && Again we don't need here but for only jobs probably>As you can see for listbox all we do is to 'stringify' SQL as RowSource :) You'd create the other listboxes the same way. You're free to have columncount 1-fcount() and only need to set columnwidths for columncount columns. You don't need to set boundto anything since you wouldn't use it at all. Instead you'd always use cursorname and fieldname to query a value. ie : at anytime you could get compid from companies listbox saying crsComps.CompID. Only exception to this is where you set listindex to 0. With SQL is rowsource record pointer moves in its cursor implicitly :)