473,396 Members | 1,773 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,396 software developers and data experts.

Conditional Formatting

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 "[MyField1] = -1 "
in the Conditional Formatting.

But what if instead of "MyField1" I want to use the field that has the
focus.
So if "MyField2" has the focus the Conditional Formatting would need to be
"Expression is" and "[MyField2] = -1

I have written a Function (FieldName()) that returns the name of the field
that has the focus but I am unable the correctly
write the Conditional Formatting the access this function.

This doesn't work [FieldName()] = -1

How can I write the Conditional Formatting so that the function FieldName()
can insert the name of the field
that has the focus between the [ ] in Expression is?
I am using Access 2000

Thanks
G. Gerard

Nov 13 '05 #1
1 4922
In your conditional formatting expression, try:
[Form].[ActiveControl]

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"GGerard" <gg*****@nbnet.nb.ca> wrote in message
news:cF**********************@ursa-nb00s0.nbnet.nb.ca...

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 "[MyField1] = -1
" in the Conditional Formatting.

But what if instead of "MyField1" I want to use the field that has the
focus.
So if "MyField2" has the focus the Conditional Formatting would need to be
"Expression is" and "[MyField2] = -1

I have written a Function (FieldName()) that returns the name of the field
that has the focus but I am unable the correctly
write the Conditional Formatting the access this function.

This doesn't work [FieldName()] = -1

How can I write the Conditional Formatting so that the function
FieldName() can insert the name of the field
that has the focus between the [ ] in Expression is?
I am using Access 2000

Thanks
G. Gerard

Nov 13 '05 #2

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

Similar topics

3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
4
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the...
8
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format...
2
by: Von Bailey | last post by:
I have a form where the conditional formatting is set on some fields to bold if certain conditions are met. However, when the conditions are met some of the data that is to bold is either not...
5
by: Andrew Chanter | last post by:
Does anyone know a way you can use conditional formatting to create a banded style view as is commonly seen on the internet. (In othe words the first record appears on a gray background, the 2nd...
0
by: GGerard | last post by:
Hello With MSAccess 2000, I have created a program with forms and applied some Conditional Formatting on some of the text box.
8
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...
4
by: midlothian | last post by:
Hello, I have conditional formatting set up on a subform based on a calculated value in the underlying query. For instance, if Sales are >$1000, the query displays "Yes," otherwise it displays...
2
by: Filips Benoit | last post by:
Dear All, Access 2003 adp on SQL_server 2005 A continious form showing 1 month based on table 'CALENDAR_MONTH_GRID' and fill with a SP. Fields: Companyname, Day1, day2, etc. The value in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.