LPARAMETERS nmen, nwmn, nadl, nripe, ngreen avg = ((nmen+nwmn+nadl)/(nripe+ngreen)) DO CASE CASE avg >= 0 and avg < 20 nColor = RGB(0,0,100) CASE avg >= 20 and avg < 30 nColor = RGB(100,0,100) CASE avg >= 30 and avg < 40 nColor = RGB(200,0,100) CASE avg >= 40 and avg < 60 nColor = RGB(0,100,100) CASE avg >= 60 nColor = RGB(0,200,100) ENDCASE RETURN ncolor * in fact, you can do anything/calculation/screening/conditioning on this method * Remember: you need to pass the data individually, since every record point is * evaluated individually when dynamic color is concerned & a grid could only display * a single table, not 2 or more, so calling different tables' field could not change * the value passed
oGrd.recordsource = "SQL_dailywork_pkg" ogrd.SetAll("DynamicBackColor", "thisform.getAVG(nmen,nwmn,nadl,nripe,ngreen)", "Column")Hope this solve your problem... If so, please press the "Star" solution to signify this could be a solution...