Avatar of Paul McCabe
Paul McCabe

asked on 

MS Access: Conditional Formatting Expression(s) for Partial Matches

Hello Experts,

I am using MS Access 2016. I have a “CompanyName” field on a continuous form, and an unbound textbox “HiLight” in the form header. Conditional formatting is set up so that “CompanyName” fields matching the term in the “HiLight” textbox are highlighted. The conditional formatting expression I am using for the “CompanyName” field is: [CompanyName] = [HiLight], and it is working just fine.

Now, I am trying to get the “CompanyName” field to highlight even if it is a partial match for the term in the “HiLight” box. This would save users having to type in the exact company name very time. In order to achieve this I have tried a whole bunch of expressions for the conditional formatting on the “HiLight” box but just cannot get it to work. Can anyone advise on what the correct expression should be ?
Microsoft Access

Avatar of undefined
Last Comment
Jeffrey Coachman
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Paul McCabe
Paul McCabe

ASKER

Thank you for your suggestion. Using this expression, when the form is opened all CompanyName fields are highlighted, but the highlighting then starts to work as intended when something is input into the "HiLight" box. I tried setting the default value of the HiLight box to "", but unfortunately all fields are still highlighted on the form opening. Any further ideas ?...
Avatar of Paul McCabe
Paul McCabe

ASKER

Actually, I solved this by tweaking your expression a little:
[HiLight] <>"" And [CompanyName] Like "*" & [HiLight] &"*"

Not sure why it works, but it does ! Many thanks for your help !
Great, ...Happy Holidays!
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo