Function Boja()
Dim a
Dim b As Integer
On Error GoTo Greska
Screen.ActiveForm.Refresh
a = Screen.ActiveControl
b = Len(Format$(a))
If Format$(a) = "" Then GoTo Kraj:
If Val(a) > 1000 Then
Screen.ActiveControl.ForeColor = 255
ElseIf Val(a) <= 1000 Then
Screen.ActiveControl.ForeColor = 0
End If
Screen.ActiveControl.SelStart = b
Kraj:
Exit Function
Greska:
MsgBox "Pogrešan upis"
GoTo Kraj
End Function
Private Sub Form_Current()
Dim a
On Error GoTo Kraj
a = Val(Me.Vrijednost)
If Format$(a) = "" Then GoTo Kraj:
If Val(a) > 1000 Then
Me.Vrijednost.ForeColor = 255
ElseIf Val(a) <= 1000 Then
Me.Vrijednost.ForeColor = 0
End If
Kraj:
End Sub
Private Sub Vrijednost_Change()
Boja
End Sub
Ime Kontrole je: Vrijednost
Sretan rad
zxz