how do I compare text with embedded spaces

  • Thread starter Thread starter doc ian john hutch
  • Start date Start date
D

doc ian john hutch

I want to search for registration numbers within tables, these numbers may
have embedded spaces. Also the registration number typed into the search form
might include embedded spaces. Ideally I would like a LIKE command that
ignored spaces.
Currently I am saving in a scratch table, removing spaces and then comparing
the value from the form with the spaces removed. This is a very long-winded
way of doing things. Is there an elegant solution?
 
SELECT *
FROM somewhere
WHERE "abc" = REPLACE(yourField, " ", "")



The VBA function Replace may not work with some Access versions. If such is
your case, use a user defined function, in a standard module, which will do
replace any space by ... no character.




Vanderghast, Access MVP
 
Back
Top