aarondewberry
IS-IT--Management
I have a simple table, [table1], with two fields in, [Date] & [Cash].
I also have a form, [frm1], with two text boxes on, [Date1] & [Date2]
I then have a query that SUms the [Cash] field within [Table1], based on the dates entered into the text boxes.
There is a third control, [Value], on [frm1], which shows the output result from my query.
There is an event procedure (After Update) on the [Date2] text box, that updates the [Value] control with the latest query output. See below..
I have added a rectangle, [Box1], to [frm1]. And what I want to do, is when the [Value] control is less than 0, I want [Box1] to turn red, else i want it to turn green.
So in the, On Current, Event on the [frm1] properties, I have put the following code...
However, when I trialed this, changing dates that would give me plus and minus values, in the [Value] control. The colour of [Box1] does not change.....
unless I click on the [Value] control, goto design view of the form, then return to normal view. The box then changes colour.
Can anyone help?
I also have a form, [frm1], with two text boxes on, [Date1] & [Date2]
I then have a query that SUms the [Cash] field within [Table1], based on the dates entered into the text boxes.
There is a third control, [Value], on [frm1], which shows the output result from my query.
There is an event procedure (After Update) on the [Date2] text box, that updates the [Value] control with the latest query output. See below..
Code:
Private Sub Date2_AfterUpdate()
[Value].Requery
End Sub
I have added a rectangle, [Box1], to [frm1]. And what I want to do, is when the [Value] control is less than 0, I want [Box1] to turn red, else i want it to turn green.
So in the, On Current, Event on the [frm1] properties, I have put the following code...
Code:
Private Sub Form_Current()
Dim green, red As Integer
green = 8454016
red = 255
If [Value] < 0 Then
Me.Box1.BackColor = red
Else
Me.Box1.BackColor = green
End If
End Sub
However, when I trialed this, changing dates that would give me plus and minus values, in the [Value] control. The colour of [Box1] does not change.....
unless I click on the [Value] control, goto design view of the form, then return to normal view. The box then changes colour.
Can anyone help?