473,406 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

IF box is filled then change colour

Hi,

I have seen exampled were if value is > x then change font/colour/etc. How
would I go about doing the same except I would like it so that it changes if
there is ANYTHING in the text box.

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading
Nov 13 '05 #1
3 2228
One way is to use Conditional Formatting and test against an
expression:

Not IsNull(<MyField>)

Kevin
Nick J<bl*************@blueyonder.co.uk> 5/2/2005
1:49:54 PM >>>Hi,

I have seen exampled were if value is > x then change
font/colour/etc. How
would I go about doing the same except I would like it so
that it changes if
there is ANYTHING in the text box.

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS
WE NEED IT FOR
REFERENCE +++

Blue Bell Trading

Nov 13 '05 #2
in the After_Update event of your textbox you can write some code like
this:

Private Sub Text1_AfterUpdate()
If Len(Text1.Text) > 0 Then Text1.ForeColor = vbBlue
End Sub

So if a user enters some text into Text1, when the user leaves Text1,
the text content of Text1 will change to blue. There are vb color
constants (in the help files) of basic colors like black, white, yellow,
blue, red, green, cyan, magenta. You can also use colors from the
Property Sheet of the textbox (in the design view of the form). If you
pick a color for your font (ForeColor property in the textbox property
sheet) from the color grid (click on the elipses ... button to the right
of the ForeColor Property to get the color grid), the color you select
will have a numeric value in the ForeColor property like 16711680 for
blue. You can write code like this to use the color number:

Private Sub Text1_AfterUpdate()
If Len(Text1.Text) > 0 Then Text1.ForeColor = 16711680
End Sub

Using the color number gives you more variety of colors you can use.

HTH

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #3
I used this and it worked just dandy.

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS WE NEED IT FOR
REFERENCE +++

Blue Bell Trading
"Kevin Nechodom" <Ke************@nospamhsc.utah.edu> wrote in message
news:d5**********@vegh.ks.cc.utah.edu...
One way is to use Conditional Formatting and test against an
expression:

Not IsNull(<MyField>)

Kevin
Nick J<bl*************@blueyonder.co.uk> 5/2/2005

1:49:54 PM >>>
Hi,

I have seen exampled were if value is > x then change
font/colour/etc. How
would I go about doing the same except I would like it so
that it changes if
there is ANYTHING in the text box.

--

Kind Regards...

Customer Services Team
Blue Bell Trading

+++ WHEN REPLYING PLEASE DO NOT DELETE ANY OF THE TEXT AS
WE NEED IT FOR
REFERENCE +++

Blue Bell Trading

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Louise | last post by:
Hi I have written an HTML pages which does not have any colour specifying tags as far I know. When I view this in an Microsoft internet explorer browser it appears with a white background and...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
1
by: ms | last post by:
Hi, I've been trying to find a way to change a cell's colour when clicking it. What I've found so far is to change the background colour by using: function whenClick(navElm) { var state1 =...
3
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
1
by: amber | last post by:
Hi there, I'd like to change the colour of my tabs. I can change my background colour of my tab control, but the actual tabs, with the text on them don't change colour. Am I missing something?...
2
by: Scott | last post by:
Is it possible to have a button change colour OnClick ? Thanks.
15
by: marko | last post by:
Hi! A have a problem. I have a table containing ID,Brend,Model,Colour,Price. The Colour field has colours like: YELLOW/BLACK/RED, YELLOW/RED, BLUE, BLUE/NAVY/RED/CHARCOAL. Now i would like to...
3
by: Mel | last post by:
Hi, Is there any way I can force to change button background colour when toggle button is checked? Just like button change its background colour when mouseover in MS Visual Studio.NET. I hope I...
0
by: Badino | last post by:
Hi, Can someone tell me what to put in this code so that if a user selects 0 (Black) then make the font white (0) as my default colour is black on my Excel spreadsheet. Private Type...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.