Re: Using a Like Statement where data can be either numeric or character.



c.santee@xxxxxxxxx wrote:
All,
I was hoping someone would be of help me figure out how to use a Like
Statement where the field contains characters or numeric values.

The type of characters in the data or search string is irrelevant. Like can
only be used for fields defined as text/character datatype. This datatype
can contain either alpha or numeric characters.

What database are you using?

When I use the following strSQL with the variable valueToCheckFor
containing only characters the SQL string executes properly and
returns the correct number of records:

valueToCheckFor = "Text"
strSQL = "SELECT [tmpCLID].[clID] FROM tmpCLID WHERE
((([tmpCLID].[clID]) Like " & Chr(34) & valueToCheckFor & "%" &
Chr(34) & "));"

However when valueToCheckFor = "Text01" even though there are records
that matches this value, my query returns zero records.

Can you reproduce this with your database's native query execution tool?



--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: Using a Like Statement where data can be either numeric or character.
    ... The type of characters in the data or search string is irrelevant. ... When I use the following strSQL with the variable valueToCheckFor ... Can you reproduce this with your database's native query execution tool? ... This email account is my spam trap so I ...
    (microsoft.public.data.ado)
  • Using a Like Statement where data can be either numeric or character.
    ... Statement where the field contains characters or numeric values. ... When I use the following strSQL with the variable valueToCheckFor ... I would be grateful for any help. ... - CES ...
    (microsoft.public.data.ado)
  • Re: ADO ActualSize vs DefinedSize Property
    ... The field is a plain ... > TEXT field, defined as 100 characters. ... Access 2000 Text fields are Unicode. ... This email account is my spam trap so I ...
    (microsoft.public.scripting.vbscript)
  • Re: DAO parameter length
    ... sc.notes is greater than 255 characters. ... Public Function saveSCToDB ... As Boolean 2 Dim qdf1 As DAO.QueryDef ... This email account is my spam trap so I ...
    (microsoft.public.access.queries)
  • Re: Query for exact word
    ... John Spencer wrote: ... are the characters on either side of a word that decides what a word ... My reason is that I need to set up an appointment. ... This email account is my spam trap so I ...
    (microsoft.public.access.queries)