Solved

Microsoft Access String Comparison query with mask

Posted on 2010-08-30
4
471 Views
Last Modified: 2012-05-10
My app has a table of part "masks". For example, there are valid part numbers like OH911-EB, OH911-EL, and OH911-E. So I have a table with the mask OH911-*. In my query, I want to find all entries which match the mask OH911-*. My syntax is:

Expr1: IIf('OH911-EB' Like [tbl_DocPart_CrossRef]![PartMask],'YES','NO')

And the conditional is 'YES'. This query fails; Expr1 never resolves to 'YES', even though I have confirmed that their are matching entries in the table.

Any thoughts?
0
Comment
Question by:rlwhitney
  • 2
4 Comments
 
LVL 13

Expert Comment

by:Surone1
ID: 33562888
iif(right([tbl_DocPart_CrossRef]![PartMask],8) = 'OH911-EB', 'YES','NO')
0
 
LVL 13

Expert Comment

by:Surone1
ID: 33562898
sorry wrong side :-)
iif(left([tbl_DocPart_CrossRef]![PartMask],8) = 'OH911-EB', 'YES','NO')
0
 
LVL 42

Accepted Solution

by:
dqmq earned 500 total points
ID: 33562917
Your Like expression should work.  Put in an exact match (no wildcards) and see what that produces.  Next, change like to = and see what that produces.  Just hitting it from different angles to gain insight.
0
 

Author Closing Comment

by:rlwhitney
ID: 33568387
You're right ... the mask was built incorrectly.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now