Darren DICK
d.dick at uws.edu.au
Wed Feb 2 16:31:10 CST 2005
Hey Gustav
Beautiful -
Now the big bit that I forgot to mention in my previous post <blush>
Will this work on a Continuous Form?
Many thanks
Darren
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, 2 February 2005 8:27 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] A2003: Formatting a text Box
Hi Darren
Not that I know of, but you can create a small function which does
this:
Private Function SetTest(ByVal varValue As Variant) As Variant
Dim lngForeColor As Long
With Me!txtTest
' Specify default ForeColor value.
lngForeColor = vbBlack
If IsNumeric(varValue) Then
If Val(varValue) > 500 Then
lngForeColor = vbBlue
Else
lngForeColor = vbRed
End If
End If
' Make other tests.
' ...
' Set ForeColor
.ForeColor = lngForeColor
End With
SetTest = varValue
End Function
Then set the ControlSource of textbox txtTest to:
=SetTest([txtInput])
Now txtTest will show the value in txtInput and adjust forecolor.
/gustav
>>> d.dick at uws.edu.au 02-02-2005 05:30:55 >>>
Hello all
I want the text in a text box to be blue or red depending on conditions
Can it be done in the control source of the Control?
I know it can be done via Conditional Formatting or in code Just wanna know
if it can be done in the control source
EG (pseudo code)
=IIf([SomeValue]=-1,Format([SomeControl].ForeColor,"vbred","vbblue"))
Many thanks
Darren
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com