[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Conditional formatting Datasheet subform

Posted on 2009-06-29
12
Medium Priority
?
376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

649 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