Solved

Conditional formatting Datasheet subform

Posted on 2009-06-29
12
371 Views
Last Modified: 2013-11-28
How do I set the conditional formatting of a field where it looks at the value of another field and using a wild card determine if the value of the current field is contained within the value of the 2nd field?

I tried to set the conditional formatting to using the Expression not equal to Like "* fieldName1 *" or Like "*& fieldName1 & *"  I even tried to use a variable function that sets the value of Field2 within the Like statement without success.  

what is the proper syntax?
0
Comment
Question by:Karen Schaefer
  • 6
  • 4
  • 2
12 Comments
 
LVL 5

Expert Comment

by:DBDevl
ID: 24738362
Try:

Like "*" & fieldName1 & "*"

or

Like "*'" & fieldName1 & "'*"
0
 

Author Comment

by:Karen Schaefer
ID: 24738449
sorry neither way works - getting a syntax error.  see attached.co
ConditionalFormatPic.jpg
0
 
LVL 5

Expert Comment

by:DBDevl
ID: 24738647
Try this:

In the Condition 1 drop down select Expression Is, then enter this, InStr([field1].Value,[field2].value)>0
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 5

Expert Comment

by:DBDevl
ID: 24738689
Put a 1 as the last parameter to make the search not case sensitive:

InStr([field1].Value,[field2].value, 1)>0
0
 
LVL 5

Expert Comment

by:DBDevl
ID: 24738716
Here is a complete description, it seems it may work for what you are trying to do.

InStr([start,] string1, string2 [, compare])

The InStr function syntax has these parts:

start Optional. Numeric expression that sets the starting position for each search. If omitted, search begins at the first character position. The start argument is required if compare is specified.

string1 Required. String expression being searched.

string2 Required. String expression sought.

compare Optional; numeric. A value of 0 (the default) specifies a binary (case-sensitive) search. A value of 1 specifies a textual (case-insensitive) search.
0
 

Author Comment

by:Karen Schaefer
ID: 24738902
sorry a little confused - When I use the InStr([Eqpt_Loc_N0].Value,[txtApNO].Value)>0, doesn't this mean if the 2 fields = each other than change the format.

I need to check if not equal to each other and also some other criteria exists.

1.  where Eqpt_Loc_N0<> txtapno
2.  Where Eqpt_Loc_N0] <> LIKE "*LH*' OR LIKE "*LAB*"

So what is the proper syntax to handle the various options?

Thanks
k
0
 
LVL 5

Expert Comment

by:DBDevl
ID: 24739112
This should return true if txtApNo, LH, LAB are not in Eqpt_Loc_No, but I haven't tested it.

(InStr([Eqpt_Loc_N0].Value,[txtApNO].Value,1)=0) And (InStr([Eqpt_Loc_N0].Value"LH",1)=0) And (InStr([Eqpt_Loc_N0].Value,"LAB",1)=0)
0
 
LVL 5

Expert Comment

by:DBDevl
ID: 24739144
So, conversely, if any of those values are in Eqpt_Loc_No it will return false.
0
 

Author Comment

by:Karen Schaefer
ID: 24739154
thanks for the assist, however problem with syntax.

K
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 24743659
kfschaefer1,

A sample would go a long way to avoiding any abiguity...

For eaxmple instead of saying:
" formatting of a field where it looks at the value of another field"
Huh?

You instead say:
I have a LastName Field on the subform, If the first 3 characters of the Last Name on the subform matches with the first 3 characters of the LastName on the Main form then make the Country Field on the subform Red.

c'mon k, how long have you known me....

;-)

Here is a sample, ...in "Real words" here is what it does.
It formats the ShipCountry in the Subform to Red if the Main form's CompanyName contains "er"  (Like "*er*")

I am sure you can take this sample and, on your own, easily adapt it for almost any combination of conditions you need.

Jeff
Access-EEQConditionallyFormatDat.mdb
0
 

Author Closing Comment

by:Karen Schaefer
ID: 31598041
Thanks Jeff, for your input as always you are a great help.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24747056
I'm trying to get you to "then next Level"

;-)

Jeff
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question