Hi Al,
In the Init() event of your grid, try something like this :
DODEFAULT()
LOCAL lcColorString
* --------------------------------------------
* Color assignments:
* quantity = 0 or EMPTY() : WHITE
* quantity < instock : GREEN
* quantity = instock : YELLOW
* quantity > instock : RED
* --------------------------------------------
lcColorString = "IIF( EMPTY(v_OrderItems.quantity), RGB(255,255,255), " + ;
"IIF( v_OrderItems.quantity < v_OrderItems.instock, RGB(0,255,0)," + ;
"IIF( v_OrderItems.quantity = v_OrderItems.instock, RGB(255,255,0), RGB(255,0,0))))"
* --------------------------------------------
* Lets assume column4 is the quantity column.
* --------------------------------------------
this.Column4.DynamicBackColor = lcColorString
The trick is how to get the instock value since you do not know the part number to look at until the user enters it. Let's assume you have a part number field called 'partnum'. In the Valid() method of the partnum field you need something that does the following:
REPLACE v_OrderItems.instock WITH GetInStockValue( v_OrderItems.partnum )
..where GetInStockValue() returns the instock value from an inventory table.
HTH
George
George Simon, MCP