Conditional formatting based on other table field

SERVERPCXP

New Member
Joined
Jul 21, 2015
Messages
3
have an formAAONE which comes from
TABLE-A
inside formAAONE have an field txtbox-AAA

need make an conticional fromatting in txtbox-AAA
AFTER IT COMPARE VALUES IN TABLE -B
TABLE-B is an list of number

is txtbox-AAA is equal to any number from TABLE-B LIST
then txtbox-AAA HAVE TO BE WITH AN CONDITIONAL FORMATING


please any idea ?
I full appreciated you help !
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try setting the condition parameter "Field Value Is" to "Expression Is" and using an expression like
=IIF(DLOOKUP([txtbox-AAA],[TABLE-B]),"True","False")="True"

What I'm trying to say is, If the value of field "txtbox" is found in B, (equals True) then the iif statement evaluates to True (thus equals the true after the last = sign). Otherwise, the iif function returns False, which is not = True at the end. A couple of caveats: not sure about the " around the true, false parts. As an integer, False always = 0, True can be 0 or -1 so you can often use integers if you know which True integer to use (in this case, I do not). Also, you have to watch that your control names are not the same as your query/table fields names or the formatting won't work. I also assume you know that you can only format the font (color, bold, etc) and not the color of the control in many versions of Access.

Another method is to place a label behind the control that has the value and set the background color of the label to be a color if the control equals something, but this would require VB code.
 
Upvote 0
Thanks Micron Very Very much
you an ligth in the dark! God bleess you !

I HAVE ACCESS 2013

I ENTER THE EXPRESSION IN THE txtbox-AAA CONDITIONAL FORMATTING MANAGER

BUT IT SAY : THE EXPRESSION YOU ENTERED CONTAIN INVALID SYNTAX YOU HAVE ENTERED A COMMA WITHOUT A PRECEDING OR IDENTIFIER.


TABLE -B- HAVE TWO FIELD - PK and PARNUM
PARNUM IS WHERE THE LIST OF NUMBERS TO SEE


I KNOW WE ARE NEAR BUT DON'T KNOW HOW

IS NOT PROBLEM IF HAVE TO BE IN VBA CODE
BUT I NEED HELP MY BRAIN IS NOT SO ADVANCED

I APRECIATED ANY HELP!
 
Upvote 0
Whenever you apply someone's suggestion and the result is like this, post the expression in your next reply so we can see it and maybe detect the problem. It might just be a typo. I am not up to speed with 2013, so I may not be able to help further after seeing your posted expression that isn't working. If you have an error number along with the message text, always post that too (and do try to be accurate about the error message - some are similar but the causes differ).
 
Upvote 0
MICRON THANKS AGAIN FOR YOU PATIENTE AND TIME WITH ME BEST FRIEND!
LIKE YOU SAY I WRITE IT :

=IIF(DLOOKUP([txtbox-AAA],[TABLE-B]),"True","False")="True"

BUT AN WINDOWS
SAY THE EXPRESSION YOU ENTERED CONTAIN INVALID SYNTAX YOU HAVE ENTERED A COMMA WITHOUT A PRECEDING OR IDENTIFIER.

THATS ALL THE WINDOWS MESSAGE SAY COME FROM


I HAVE TO SAY THE NUMBERS IN TABLE-B ARE IN TXT AND THE NUMBERS IN txtbox-AAA
ARE IN TXT TOO.

IF HAVE TO BE IN VBA IS OK TO ME BUT DON'T KNOW
HAVE TO BE WITH RECORDSET ? HOW I CAN DO AN RECORDSET ?

HOW COULD BE THE EXPRESSION ? TO FORMAT txtbox-AAA??
 
Upvote 0
You must write the expression as given below:

Code:
EXPRESSION IS [txtbox-AAA]=Dlookup("FieldName","TABLE-B","FieldName=" & [txtbox-AAA])

Replace the actual Field Name, where the value is stored in TABLE-B, wherever I have written FieldName in quotes. You must write the field name in quotes.

You can find a blog post on this subject here External References in Conditional Formatting Expression | LEARN MS-ACCESS TIPS AND TRICKS for more details.
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,772
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top