Solved

Microsoft Access String Comparison query with mask

Posted on 2010-08-30
4
476 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
[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
  • 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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, when working with VBA, learn some techniques for writing readable and easily maintained code.

726 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