[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 482
  • Last Modified:

Microsoft Access String Comparison query with mask

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
rlwhitney
Asked:
rlwhitney
  • 2
1 Solution
 
Surone1Commented:
iif(right([tbl_DocPart_CrossRef]![PartMask],8) = 'OH911-EB', 'YES','NO')
0
 
Surone1Commented:
sorry wrong side :-)
iif(left([tbl_DocPart_CrossRef]![PartMask],8) = 'OH911-EB', 'YES','NO')
0
 
dqmqCommented:
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
 
rlwhitneyAuthor Commented:
You're right ... the mask was built incorrectly.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now