Results 1 to 4 of 4
  1. #1
    newyorkyankee is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    11

    Question How to use wildcard query criteria with full object name?


    I have a text box in a form and the query criteria is like this:
    Code:
    Like "[Forms]![frm_My_Form].[Controls]![txt_Word_Name]"
    But it returns only the records that are identical to the text in the text field, and I want all the records that contain that word somewhere in the field, as when using the asterisk (*) wildcard enclosing the word. How to do it since it's not possible to use this wildcard in this expression? Here goes the SQL code of the query:
    Code:
    SELECT tbl_My_Table.[Item_ID], tbl_My_Table.[Item_Name]
    FROM tbl_My_Table
    WHERE (((tbl_My_Table.[Item_Name]) Like "[Forms]![frm_My_Form].[Controls]![txt_Word_Name]"));

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Try

    Like "*" & [Forms]![frm_My_Form].[Controls]![txt_Word_Name] & "*"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    newyorkyankee is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2012
    Posts
    11
    Excellent! Thank you pbaldy.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-13-2012, 03:38 PM
  2. Problem with a wildcard in a query criteria
    By desk4tbc in forum Programming
    Replies: 1
    Last Post: 08-10-2011, 06:02 PM
  3. Replies: 5
    Last Post: 02-09-2011, 11:22 AM
  4. Query to Reset AutoNumber to 1 after full delete
    By saigovind in forum Queries
    Replies: 1
    Last Post: 02-04-2011, 03:43 AM
  5. Parameter Query & Wildcard
    By Rick West in forum Queries
    Replies: 8
    Last Post: 12-29-2009, 10:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums