cgship=substr(othernr.shipmentid,3,3) > >thisform.grdnrother.shipment.dynamicbackcolor= [IIF(alltrim(cgship)='G',rgb(255,0,0),RGB(255,255,255))]because cgship is going out of scope. try:
cgship=[ALLTRIM(substr(othernr.shipmentid,3,3))] thisform.grdnrother.shipment.dynamicbackcolor= [IIF(]+cgship+[='G',rgb(255,0,0),RGB(255,255,255))]