467,877 Members | 1,130 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,877 developers. It's quick & easy.

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
  • viewed: 4052
Share:
1 Reply
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bradley | last post: by
8 posts views Thread by Dimitri Furman | last post: by
2 posts views Thread by Von Bailey | last post: by
5 posts views Thread by Andrew Chanter | last post: by
reply views Thread by GGerard | last post: by
2 posts views Thread by Filips Benoit | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.