Como comparar um mesmo campo no subform,alterando cor quando o valor for maior?
Subform continuo
Subform continuo
Private Sub Form_Timer()
Dim valorMax As Double
On Error Resume Next
valorMax = DMax("vendaavista", "tblVendas", "datavenda between #" & Format(Parent!dtini, "mm/dd/yyyy") & "# and #" & Format(Parent!dtfinal, "mm/dd/yyyy") & "#")
Me!Texto58.FormatConditions.Delete
Me!Texto58.FormatConditions.Add acExpression, , "[texto58]=" & Replace(valorMax, ",", ".")
With Me!Texto58.FormatConditions(0)
.ForeColor = vbWhite
.BackColor = vbRed
End With
Me.TimerInterval = 0
End Sub
Private Sub Form_Timer()
Dim valorMax As Double
Dim valorMin As Double
On Error Resume Next
valorMax = DMax("vendaavista", "tblVendas", "datavenda between #" & Format(Parent!dtini, "mm/dd/yyyy") & "# and #" & Format(Parent!dtfinal, "mm/dd/yyyy") & "#")
valorMin = DMin("vendaavista", "tblVendas", "datavenda between #" & Format(Parent!dtini, "mm/dd/yyyy") & "# and #" & Format(Parent!dtfinal, "mm/dd/yyyy") & "#")
Me!Texto58.FormatConditions.Delete
Me!Texto58.FormatConditions.Add acExpression, , "[texto58]=" & Replace(valorMax, ",", ".")
Me!Texto58.FormatConditions.Add acExpression, , "[texto58]=" & Replace(valorMin, ",", ".")
With Me!Texto58.FormatConditions(0)
.ForeColor = vbWhite
.BackColor = vbBlue
End With
With Me!Texto58.FormatConditions(1)
.ForeColor = vbWhite
.BackColor = vbRed
End With
Me.TimerInterval = 0
End Sub