select statement question

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

Guest

I am adding a search function and did the following SELECT statement behind a
button. I would like to be able to have the wildcard be placed at any spot
during the user's typing in the search textbox. The SELECT statement below
does not look correct. I tried it but didn't get anything in return several
times. Is there something missing?

SELECT tbl_Parcels.*
FROM tbl_Parcels
WHERE tbl_Parcels.ParcelNumber
LIKE '" & sParcelNumber & "%'
ORDER BY tbl_Parcels.ParcelNumber

Thanks for responding.
.... John
 
JohnE said:
I am adding a search function and did the following SELECT statement
behind a button. I would like to be able to have the wildcard be
placed at any spot during the user's typing in the search textbox.
The SELECT statement below does not look correct. I tried it but
didn't get anything in return several times. Is there something
missing?

SELECT tbl_Parcels.*
FROM tbl_Parcels
WHERE tbl_Parcels.ParcelNumber
LIKE '" & sParcelNumber & "%'
ORDER BY tbl_Parcels.ParcelNumber

Thanks for responding.
... John

If the user is going to enter the wildcard then your statement should not
have it. Also, the wild card in Access/Jet is normally *, not % unless you
are doing this with ADO.
 
Back
Top