Using LIKE in an Access DSN-LESS query.

Results 1 to 4 of 4

Thread: Using LIKE in an Access DSN-LESS query.

  1. #1
    Mark Guest

    Default Using LIKE in an Access DSN-LESS query.

    Well, here it is:<BR><BR>SELECT * FROM GGroups WHERE (Group LIKE "*services*");<BR><BR>Works inside of Access, but try as many types of syntaxes, can&#039t seem to get it to work from an AS Page . . . anyone every gotten a LIKE to work?<BR><BR>Basically, I am trying to search the one field for any string match. The only way I can do it is to pull the entire field, and perform an InStr() on every record. SIGH

  2. #2
    MARK Guest

    Default RE: ANSWERED MYSELF!! Using LIKE in an Access DSN-

    Gee, if I had looked around first, I could have not needed to post!!<BR><BR>Answer is:<BR><BR>SELECT * FROM GGroups WHERE (Group LIKE "%services%")<BR><BR>So, percents work outside Access just like the asteriks work insdie Access.<BR><BR>Thanks to all!

  3. #3
    Join Date
    Dec 1969

    Default RE: Using LIKE in an Access DSN-LESS query.

    you can try % instead of *<BR><BR>happy programming<BR>

  4. #4
    Jason Buck Guest

    Default RE: Using LIKE in an Access DSN-LESS query.

    I could not reply to the initial thread. So I had to reply to this thread.<BR><BR>Here is what my actual code looks like for an example to your search question. Like &#039%" & strsearch & "%&#039 . Notice that the % is on both sides of the string.<BR>If you have any other questions, feel free to contact me.<BR><BR>Jason <BR><BR>&#060;%<BR>strSearch = request.form("searchvalue")<BR><BR><BR>strConnect = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:databasequickref.mdb"<BR><BR>dim objconn, objrec, mysql, strStatus, Mytest, strLength<BR>set objconn = server.createobject("ADODB.Connection")<BR><BR><BR > strConnect<BR><BR><BR>mysql = "SELECT tblPrograms.ProgramName, tblQuickRefs.QuickRefName, tblQuickRefs.QuickRefKeyWords FROM tblPrograms INNER JOIN tblQuickRefs ON tblPrograms.ProgramID = tblQuickRefs.ProgramID WHERE (((tblQuickRefs.QuickRefKeyWords) Like &#039%" & strsearch & "%&#039)) or (((tblPrograms.ProgramName) Like &#039%" & strsearch & "%&#039));"<BR><BR><BR><BR><BR>set rstemp=objConn.execute(mysql)<BR><BR>strPath = "http://wnjinet/is/helpdesk/quickreference/"<BR>response.write "&#060;table&#062;"<BR>If not rstemp.eof then<BR><BR><BR><BR><BR> Do While Not rstemp.EOF<BR>strQuickRefName = rstemp("QuickRefName")<BR>strQuickRefKeyWords = rstemp("QuickRefKeyWords")<BR>strProgramName = rstemp("ProgramName")<BR><BR>response.write "&#060;tr&#062;&#060;td&#062;" & strProgramName & "&#060;/td&#062;&#060;td&#062;&#060;a href=&#039" & strPath & strQuickRefName & "&#039&#062;" & strQuickRefKeyWords & "&#060;/a&#062;&#060;/td&#062;&#060;/tr&#062;"<BR><BR><BR>rstemp.movenext<BR><BR> Loop<BR><BR>End if<BR>response.write "&#060;/table&#062;"<BR><BR> rstemp.close<BR> <BR><BR>Set rstemp = nothing<BR>objConn.close<BR>Set objConn = nothing<BR><BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts