Formatting 在Access2007中以无限形式格式化行

Formatting 在Access2007中以无限形式格式化行,formatting,ms-access-2007,continuous-forms,Formatting,Ms Access 2007,Continuous Forms,我的数据库应用程序中有一个连续的表单。在这种形式下,一个有3列的表的数据显示为:product、NumberOfItemsOday、NumberOfItemsOday 现在,如果numberofItemsOfToday!=对应行中昨天的项目数 我试过类似的东西 Private Sub Form_Current() addConditionalFormatingText txtnumberofItemsOfToday, numberOfItemsOfYesterday, txtProduc

我的数据库应用程序中有一个连续的表单。在这种形式下,一个有3列的表的数据显示为:product、NumberOfItemsOday、NumberOfItemsOday

现在,如果numberofItemsOfToday!=对应行中昨天的项目数

我试过类似的东西

Private Sub Form_Current()
    addConditionalFormatingText txtnumberofItemsOfToday, numberOfItemsOfYesterday, txtProduct, txtnumberofItemsOfToday, txtnumberOfItemsOfYesterday
End Sub

Private Sub addConditionalFormatingText(field1 As Object, field2 As Object, t1 As TextBox, t2 As TextBox, t3 As TextBox)
    Dim color As Long
    color = IIf(CBool(Nz(field1.Value, "") <> Nz(field2.Value, "")), RGB(255, 0, 0), RGB(0, 0, 0))
    t1.ForeColor = color
    t2.ForeColor = color
    t3.ForeColor = color
End Sub
Private子表单_Current()
添加条件格式文本txtNumberOfItemsToday、numberOfItemsOfDay、txtProduct、txtNumberOfItemsOfDay、txtNumberOfItemsOfDay
端接头
私有子addConditionalFormatingText(字段1作为对象,字段2作为对象,t1作为文本框,t2作为文本框,t3作为文本框)
淡色如长
颜色=IIf(CBool(Nz(field1.Value,”)Nz(field2.Value,”)),RGB(255,0,0),RGB(0,0))
t1.前景色=颜色
t2.前景色=颜色
t3.前景色=颜色
端接头

但当然问题是,如果一行中的值不同,则所有行都被涂成红色。我怎样才能以连续的形式设置特殊行的颜色?

为什么不使用真正的条件格式?您似乎正在重新发明轮子,使用Remou的链接可以帮助您在<5分钟内实现所需的内容,而无需编码。非常感谢!我不知道那个函数。这正是我想要的。