我有一张带有子表单的表单。该表单包含以下VBA条件格式,一切都像魅力:
Private Sub Form_Current()
x = Date + 183
y = Date + 91
z = Date + 30
On Error Resume Next
Select Case Me.tblContractTotalOptionsIncluded
Case Is = Me!subfrmContractCLIN.Form.tblContractCLINDescriptionID - 1
Select Case Me!subfrmContractCLIN.Form.tblContractCLINExpirationDate
Case Is < Date
Me.tblContractNumber.BackColor = RGB(70, 0, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 0, 0)
End Select
Case Is > 5
Me.tblContractNumber.BackColor = RGB(70, 0, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 0, 0)
Case Else
Select Case Me!subfrmContractCLIN.Form.tblContractCLINExpirationDate
Case Is < Date
Me.tblContractNumber.BackColor = RGB(0, 0, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 255, 255)
Case Is < z
Me.tblContractNumber.BackColor = RGB(255, 0, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 242, 0)
Case Is < y
Me.tblContractNumber.BackColor = RGB(255, 242, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 0, 0)
Case Is < x
Me.tblContractNumber.BackColor = RGB(255, 242, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(0, 0, 0)
Case Else
Me.tblContractNumber.BackColor = RGB(255, 255, 255)
Me.tblContractNumber.FontBold = False
Me.tblContractNumber.ForeColor = RGB(0, 0, 0)
End Select
End Select
End Sub
我的用户抱怨他们希望看起来更像是F $%@ * $ g excel电子表格。因此,除了其他美学变化之外,我已经将“subfrmContractCLIN”子表单更改为名为“subrptContractCLIN”的报表,因为报表上的Can Grow属性比连续表单上的更好。为了生成报告,我从子表单复制了Record Source SQL并将其用于子报表。我在子表单上的所有字段都包含在子报表中。
以下是我的更改以上代码的摘录。您可能已经猜到下面的代码不起作用。
Select Case Me.tblContractTotalOptionsIncluded
Case Is = Me!subrptContractCLIN.Report.tblContractCLINDescriptionID - 1
Select Case Me!subrptContractCLIN.Report.tblContractCLINExpirationDate
Case Is < Date
Me.tblContractNumber.BackColor = RGB(70, 0, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 0, 0)
End Select
Case Is > 5
Me.tblContractNumber.BackColor = RGB(70, 0, 0)
Me.tblContractNumber.FontBold = True
Me.tblContractNumber.ForeColor = RGB(255, 0, 0)
Case Else
Select Case Me!subrptContractCLIN.Report.tblContractCLINExpirationDate
你可以提供给我的任何帮助,这样我就可以帮助我的excel爱好,在晚上睡觉的metathesiophobic用户将非常感激。