Solved

Microsoft Access String Comparison query with mask

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
type of query 11 42
vba sql wild card passing in code 3 24
Solved: How can I prevent deletions from a form in datasheet view? 5 28
Exporting Access Tables as CSV 3 24
This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

777 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