The trick is to place the wildcard character in square brackets, so Access
treats it as a literal.
This kind of thing:
SELECT *
FROM Equipment
WHERE EquipName LIKE "1[#]motor*";
So, of tblEquipName is a variable that may contain the # character:
SELECT *
FROM Equipment
WHERE EquipName LIKE """" & Replace(tblEquipName,"#","[#]") & "*""";
Of course, if you know exactly what you are looking for, you could just use
= instead of Like:
SELECT *
FROM Equipment
WHERE EquipName = "1#motor";
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Huayang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In access 2000, how to handle the char string including #, like this
> equipment name is "1# motor". ths SQL is:
>
> SELECT * FROM Equipment WHERE EquipName LIKE '" & tbEquipName & "*';"
>
> but cann't retrieve equipment data.
>
> Thanks