TonC
07-28-2017, 11:51 AM
Hello,
In my form there is a textfield. In the property control source the next line:
=DSum("Bedrag";"tblWareHouse1"). Its a textfield, but it gives me the correct amount I need to see.
What I would like to know, if I open my form, and the field shows me a positive amount, the backcolor of the field must be green. For a negative amount, the color red.
The name of the field is txtSaldoWH1.
I’ve tried to convert the textfield into a several functions as such as: Val() and CDbl() , but nothing seems to work.
my code until now,
Private Sub Form_Open(Cancel As Integer)
If Me.txtSaldoWH1.value >= 0 Then
Me.txtSaldoWH1.BackColor = RGB(0, 255, 0)
Else
Me.txtSaldoWH1.BackColor = RGB(255, 0, 0)
End If
End sub
Any help please.
TonC
In my form there is a textfield. In the property control source the next line:
=DSum("Bedrag";"tblWareHouse1"). Its a textfield, but it gives me the correct amount I need to see.
What I would like to know, if I open my form, and the field shows me a positive amount, the backcolor of the field must be green. For a negative amount, the color red.
The name of the field is txtSaldoWH1.
I’ve tried to convert the textfield into a several functions as such as: Val() and CDbl() , but nothing seems to work.
my code until now,
Private Sub Form_Open(Cancel As Integer)
If Me.txtSaldoWH1.value >= 0 Then
Me.txtSaldoWH1.BackColor = RGB(0, 255, 0)
Else
Me.txtSaldoWH1.BackColor = RGB(255, 0, 0)
End If
End sub
Any help please.
TonC