Criteria on "Like"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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]
 
Back
Top