Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Aug 2010
    High Point, NC
    Thanked 363 Times in 360 Posts

    wildcards for access.

    I know this isnt an access db forum, but my question has more to do with SQL and support in access for wildcard searches.

    My query below seems correct, but its not filtering any data out based on my form field value and the wildcard "%". It returns all records from the table.

    <cfset projectName="projectName">
    <cfparam name="URL.ID" default="1">
    <cfparam name="FORM.projectName" default="" type="string">
    <cfquery name="plm" datasource="dawnFoods">
    SELECT ProductDataSpec.ID, ProductDataSpec.projectName
    FROM ProductDataSpec
    WHERE ProductDataSpec.ID = ProductDataSpec.ID

    <cfif FORM.projectName IS NOT "">
    AND ProductDataSpec.projectName LIKE '#FORM.projectName#%'

    <!--- All Results Ordered by brand and Item--->
    ORDER BY ProductDataSpec.projectName ASC

    Not sure I see whats wrong with the sql code. Hope someone can help. Thanks in advanced!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,827 Times in 4,788 Posts
    Access uses * for wild card, not %.

    Though that can depend upon the connection string you used, so if * doesn't work, post your connection string.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


    Posting Permissions

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