Criteria on "Like"

A

acss

I am running a union query in which on export there is a workbook created and
two sheet are inserted. On one of these sheets i am using ((TT.InvDesc) Like
"AUDIT" & "*") yet i see some audit records on the other sheet which should
not be there.How do i ensure that the like statement will filter ALL records
with AUDIT within the description?
 
J

John W. Vinson

I am running a union query in which on export there is a workbook created and
two sheet are inserted. On one of these sheets i am using ((TT.InvDesc) Like
"AUDIT" & "*") yet i see some audit records on the other sheet which should
not be there.How do i ensure that the like statement will filter ALL records
with AUDIT within the description?

The criterion you're using will find all records where the first five letters
of the InvDesc field are AUDIT - followed by any string of zero or more
characters (that's what the wildcard * means).

If you want to find AUDIT anywhere within the field (e.g. if InvDesc were "All
the seats in the auditorium") use

LIKE "*AUDIT*"

or if you want to do it the hard way, but equivalently,

LIKE "*" & "AUDIT" & "*"


John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top