473,748 Members | 6,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conditional formatting of textbox

Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working

Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackC olor = RGB(255, 255, 0)
Else
Me!STATUS.BackC olor = RGB(255, 255, 255)
End If
End Sub
'Thanks!

May 29 '07 #1
4 8972
On May 29, 1:48 pm, slinky <campbellbrian2 ...@yahoo.comwr ote:
Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working

Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackC olor = RGB(255, 255, 0)
Else
Me!STATUS.BackC olor = RGB(255, 255, 255)
End If
End Sub

'Thanks!
http://www.mvps.org/access/forms/frm0047.htm

May 29 '07 #2
On 29 May 2007 10:48:33 -0700, slinky wrote:
Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working

Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackC olor = RGB(255, 255, 0)
Else
Me!STATUS.BackC olor = RGB(255, 255, 255)
End If
End Sub

'Thanks!
Use Conditional formatting (Access 2000 or newer).
In Form Design view, right-click on the [Status] control and select
Conditional formatting.
Set the Condition1 drop-down to Field Value Is.
Select "equal to" in the next drop-down box
Write "Inactive"
in the next box.
Select the BackColor.
Save the changes.

Note: the above assumes the datatype of the [Status] control is Text.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
May 29 '07 #3
On May 29, 11:04 pm, fredg <fgutk...@examp le.invalidwrote :
On 29 May 2007 10:48:33 -0700, slinky wrote:
Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working
Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackC olor = RGB(255, 255, 0)
Else
Me!STATUS.BackC olor = RGB(255, 255, 255)
End If
End Sub
'Thanks!

Use Conditional formatting (Access 2000 or newer).
In Form Design view, right-click on the [Status] control and select
Conditional formatting.
Set the Condition1 drop-down to Field Value Is.
Select "equal to" in the next drop-down box
Write "Inactive"
in the next box.
Select the BackColor.
Save the changes.

Note: the above assumes the datatype of the [Status] control is Text.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Hi Fred,

Any idea why this does not work for multi-valued combo box? i.e. if
above formating is used, it works only if that single value is
selected. If multiple values are selected with that value, it does not
work.

May 30 '07 #4
On 29 May 2007 22:48:09 -0700, Matuag wrote:
On May 29, 11:04 pm, fredg <fgutk...@examp le.invalidwrote :
>On 29 May 2007 10:48:33 -0700, slinky wrote:
>>Thanks in advance... I have a continuous style form with a field for
each record called "STATUS". I simply want to have the form load and
if the value of the textbox is "Inactive" I want the textbox
background to display yellow, else I want it to be just white. Here's
my code... but it is not working
>>Private Sub Form_Load()
If Me!STATUS = "Inactive" Then
Me!STATUS.BackC olor = RGB(255, 255, 0)
Else
Me!STATUS.BackC olor = RGB(255, 255, 255)
End If
End Sub
>>'Thanks!

Use Conditional formatting (Access 2000 or newer).
In Form Design view, right-click on the [Status] control and select
Conditional formatting.
Set the Condition1 drop-down to Field Value Is.
Select "equal to" in the next drop-down box
Write "Inactive"
in the next box.
Select the BackColor.
Save the changes.

Note: the above assumes the datatype of the [Status] control is Text.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Hi Fred,

Any idea why this does not work for multi-valued combo box? i.e. if
above formating is used, it works only if that single value is
selected. If multiple values are selected with that value, it does not
work.
1) A combo Box cannot contain multiple values. Perhaps you meant to
say a List Box.

2) Well if you select "x" and "y" and "z" in a list box, then it's
value is xyz, not just x.

3) To work with a multi-select list box you'll need to use code to
cycle through the selections and do something with them. There is
sample code in VBA help to do this.

4) Why didn't you state, in your original post, that it was a
multi-select list box?


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
May 30 '07 #5

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

Similar topics

1
5005
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of "MyField1" is True. No problem, I just need to write "Expression is" and " = -1 "
2
2350
by: jodyblau | last post by:
I'm not certain that what I am trying to do is possible; in any event I haven't been able to figure it out. Here is what I am trying to do: I have one table that has a list of cases I'm working on. I have a second table that contains a list of tasks to be performed and relates to the Case_List through a Case_ID. So currently, I can bring up a form that has a list of all my cases, I can then select a case and it opens a new form that...
5
4707
by: jodyblau | last post by:
I am trying to do some conditional formatting with a textbox and I am not able to quite get it. Here is the setup: My record includes a textbox called and two checkboxes the first called the second called . I would like the box to set the background to RED if the is less than today's date and and
8
8506
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works perfectly. However, I have code that runs under the ON CLICK event. The code changes the focus to other controls, which means the conditional formatting is no longer displayed. This part makes sense to me. Here's what doesn't make sense. The last...
2
8615
by: Lyn | last post by:
Hi, Having fun trying to get Conditional Formatting working on a textbox control in a continuous form subform (Access 2003). The condition I want is when the value of the textbox is Null and/or an empty string. 1) Using Access: I select "Field value is" and "equal to". Not sure what to put in the Expression1 field. Have tried leaving it empty, inserting a pair of double quotes (""), a pair of single quotes ('') and the word Null. None...
10
8655
by: Lyn | last post by:
Hi, I would like to make a bound text box not visible if it is empty (not just disable it). This option is not available from the standard conditional formatting feature (at least, not that I can find). I thought of calling a class module function via Expression Builder for the control. I have written a basic function, but don't seem to be able to pass the relevant arguments correctly. It seems to me that I need to pass two...
2
3312
by: robertng90025 | last post by:
I'm having a problem with MS Access 2003 and its conditional formatting. I have textboxes on a continuous form whose left and right margins are set to 0.03 inches. Based on each textbox's current value, I set its background color. No problem with this part. My problem is that when clicking different text boxes representing the records on the continuous form, the left and the right margin areas do not always take on the background...
1
2503
by: Earl Anderson | last post by:
A business colleague and I are collaborating 'long distance' on an applet for work. He is doing the programming and I am doing the business process form design. We had discussed my desire to make all of the textbox fields with the 'focus' become a 'light orange' in backcolor. He is working in A2k3/WinXP and I am working in A2002/WinXP (The users of the applet have A2k3). In our preliminary discussions about this particular enhancement,...
1
2548
by: Greg (codepug | last post by:
Access 2000 Using a textbox of a single form, I created a calculated field. The following code is in the Control Source for this field: =IIf(=24,+(/),/ ) The numbers that are calculated are correct, and is working fine. Using Conditional Formatting for this textbox, I attempt to change the
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9325
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6796
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.