database - Changing Row Colour according to condition -
i using ms access database administration. have seeveral linked tables producing different reports. have found similar question on stackoverflow , did reaserach on issue. trying paint rows according conditions (duration <20 paint beige, 2060 red)
i using vbasic. code.
please let me know think. many help!
sub changebacktype() me.date.backstyle = 1 me.cell.backstyle = 1 me.maintenance_category.backstyle = 1 me.duration.backstyle = 1 me.line_description.backstyle = 1 me.machine_description.backstyle = 1 me.station_number.backstyle = 1 me.fault_description.backstyle = 1 me.gm.backstyle = 1 me.remarks.backstyle = 1 me.intervention.backstyle = 1 me.technician_name.backstyle = 1 me.shop_floor.backstyle = 1 end sub sub paint_rows_red()
'same method other colours
me.date.backcolor = rgb(255, 29, 29) me.cell.backcolor = rgb(255, 29, 29) me.maintenance_category.backcolor = rgb(255, 29, 29) me.duration.backcolor = rgb(255, 29, 29) me.line_description.backcolor = rgb(255, 29, 29) me.machine_description.backcolor = rgb(255, 29, 29) me.station_number.backcolor = rgb(255, 29, 29) me.fault_description.backcolor = rgb(255, 29, 29) me.intervention.backcolor = rgb(255, 29, 29) me.gm.backcolor = rgb(255, 29, 29) me.remarks.backcolor = rgb(255, 29, 29) me.technician_name.backcolor = rgb(255, 29, 29) me.shop_floor.backcolor = rgb(255, 29, 29) end sub private sub report_load() changebacktype dim test string test = teststring2 teststring2 = me!duration.value teststring2 = formatdatetime(teststring2, vbshorttime) if teststring2 <= cdate("00:20") paint_rows_beige elseif teststring2 > cdate("00:20") , teststring2 < cdate("00:60") paint_rows_orange elseif teststring2 >= cdate("00:60") paint_rows_red end if
i trying paint rows according condition mentioned above in report. code getting 1 colour..
when open report/form multiple rows, code use apply first row appearing in data. in short, code not work.
there way color rows on different criteria using conditional formatting.
Comments
Post a Comment