By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,080 Members | 1,855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,080 IT Pros & Developers. It's quick & easy.

Conditional Formatting

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.