Conditional Formatting with expression to check if field has focus

G

Guest

Hello,

I wanted to create a expression to use for a conditional format that would
check if the field has the focus and something else. Im using a datasheet.

I tried an expression like this but it doesnt work. Not so good with
expressions though.

Me.ActiveControl.Properties("Name")="txtOrderResult" AND
[txtOrderResult].Value<>"Successful"

Is there anyway to do such a thing.

There is the "Field has focus" option on the conditional formatting dialog,
but no way to add an AND to that.

Thanks!
 
G

Guest

Hi KrazyKoder,

You might want to try the following:
1. Create a form with the datasheet view (if you don't have it allready)
2. Use the menu Format -> Conditional Formatting...
3. Use the option "Field Has Focus"

Good luck!
Don
 
G

Guest

Sorry, forgot to add that you might want to "add" new conditions instead of
trying to use the AND statement.

hope it works.

Don said:
Hi KrazyKoder,

You might want to try the following:
1. Create a form with the datasheet view (if you don't have it allready)
2. Use the menu Format -> Conditional Formatting...
3. Use the option "Field Has Focus"

Good luck!
Don
---------

KrazyKoder said:
Hello,

I wanted to create a expression to use for a conditional format that would
check if the field has the focus and something else. Im using a datasheet.

I tried an expression like this but it doesnt work. Not so good with
expressions though.

Me.ActiveControl.Properties("Name")="txtOrderResult" AND
[txtOrderResult].Value<>"Successful"

Is there anyway to do such a thing.

There is the "Field has focus" option on the conditional formatting dialog,
but no way to add an AND to that.

Thanks!
 
A

Allen Browne

Hmm. I don't see how you can combine that with other expressions in the same
format condition.

The FormatCondition has a Type property
The Type indicates if it is acExpression, acFieldHasFocus, or acFieldValue.
If it is acFieldHasFocus, you don't get to add other expressions to the same
FormatCondition.
 
G

Guest

Allen,
You're wright about that. It needs some more thoughts.
Don

Allen Browne said:
Hmm. I don't see how you can combine that with other expressions in the same
format condition.

The FormatCondition has a Type property
The Type indicates if it is acExpression, acFieldHasFocus, or acFieldValue.
If it is acFieldHasFocus, you don't get to add other expressions to the same
FormatCondition.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

KrazyKoder said:
Hello,

I wanted to create a expression to use for a conditional format that would
check if the field has the focus and something else. Im using a
datasheet.

I tried an expression like this but it doesnt work. Not so good with
expressions though.

Me.ActiveControl.Properties("Name")="txtOrderResult" AND
[txtOrderResult].Value<>"Successful"

Is there anyway to do such a thing.

There is the "Field has focus" option on the conditional formatting
dialog,
but no way to add an AND to that.

Thanks!
 
G

Guest

Thanks for replies.

I think It's a limitation I can't overcome easily.
I'll plan to make my end user chose whats more importaint to them.

Someone from another site came up with a solution but suggested not to use
it. Heavy solution for small functionality & then the end user would want
more & eventually hit a limitation due to the 3 codition limit anyway.
--
KrazyKoder


Don said:
Allen,
You're wright about that. It needs some more thoughts.
Don

Allen Browne said:
Hmm. I don't see how you can combine that with other expressions in the same
format condition.

The FormatCondition has a Type property
The Type indicates if it is acExpression, acFieldHasFocus, or acFieldValue.
If it is acFieldHasFocus, you don't get to add other expressions to the same
FormatCondition.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

KrazyKoder said:
Hello,

I wanted to create a expression to use for a conditional format that would
check if the field has the focus and something else. Im using a
datasheet.

I tried an expression like this but it doesnt work. Not so good with
expressions though.

Me.ActiveControl.Properties("Name")="txtOrderResult" AND
[txtOrderResult].Value<>"Successful"

Is there anyway to do such a thing.

There is the "Field has focus" option on the conditional formatting
dialog,
but no way to add an AND to that.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top