SET LIBRARY TO ( HOME( ) + "FoxTools.FLL" ) && for RGBCOMP() function, see FoxTools.CHM help CREATE CURSOR TestResults ; ( RedVal I ; , GreenVal I ; , BlueVal I ; , RedValOK L ; , GreenValOK L ; , BlueValOK L ) LOCAL ; lnRedTest ; , lnGreenTest ; , lnBlueTest ; , lnRedResult ; , lnGreenResult ; , lnBlueResult FOR m.lnRedTest = 0 TO 255 STEP 1 FOR m.lnGreenTest = 0 TO 255 STEP 1 FOR m.lnBlueTest = 0 TO 255 STEP 1 =RGBCOMP( RGB( m.lnRedTest, m.lnGreenTest, m.lnBlueTest ), @m.lnRedResult, @m.lnGreenResult, @m.lnBlueResult ) INSERT INTO TestResults ; ( RedVal ; , GreenVal ; , BlueVal ; , RedValOK ; , GreenValOK ; , BlueValOK ) ; VALUES ; ( m.lnRedTest ; , m.lnGreenTest ; , m.lnBlueTest ; , ( m.lnRedTest = m.lnRedResult ) ; , ( m.lnGreenTest = m.lnGreenResult ) ; , ( m.lnBlueTest = m.lnBlueResult ) ) ENDFOR ENDFOR ENDFOR SELECT ; * ; FROM TestResults A ; WHERE NOT A.RedValOK ; OR NOT A.GreenValOK ; OR NOT A.BlueValOK ; INTO CURSOR RGBFuncBugs ; ORDER BY A.RedVal, A.GreenVal, A.BlueVal * Zero rows returned in RGBFuncBugs cursorInteresting side note - on my system, all of the above code, including the SELECT at the end, runs in just about exactly one minute. It's generating a little over 16M rows in the TestResults cursor in that time, or more than 250,000 rows per second !