Solved

Microsoft Access String Comparison query with mask

Posted on 2010-08-30
4
475 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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.
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…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

856 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