Connecting Tech Pros Worldwide Forums | Help | Site Map

Conditional Formatting

GGerard
Guest
 
Posts: n/a
#1: Nov 13 '05
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




Allen Browne
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Conditional Formatting


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" <ggerard@nbnet.nb.ca> wrote in message
news:cFd7f.113439$Ph4.3480138@ursa-nb00s0.nbnet.nb.ca...[color=blue]
>
> 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[/color]


Closed Thread