Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2016
    Posts
    1

    Unanswered: Access Query LIKE Function HELP!!!!

    Hi All,
    I've been trying to get this query function to work for a while now and it is driving me INSANE.

    I have documents that I'm keeping track of using a unique identifier (SOF#) in the format: "ABCDEF01-234567".
    I have a form called "frmSOFSearch" where I enter that identifier into text box "txtSOF".
    I want to be able to enter a section of that SOF# and be able to see a list of all SOFs that contain that phrase.
    I've built a query where I've set the conditions for the SOF value to: Like "*[Forms]![frmSOFSearch]![txtSOF]*"
    When I run the query, I get no results unless I enter the entire SOF number.

    What in the world am I doing wrong?!

    Thanks!

    Click image for larger version. 

Name:	Access SCRN1.png 
Views:	2 
Size:	3.2 KB 
ID:	17067Click image for larger version. 

Name:	Access SCRN2.png 
Views:	1 
Size:	23.1 KB 
ID:	17068

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Sorry can we see the actual SQL, switch to the SQL view and post it here....

    But first guess is you need to escape from the SQL to vb
    Code:
    'Like "*' &[Forms]![frmSOFSearch]![txtSOF]* & '"'
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jan 2009
    Location
    Kerala, India
    Posts
    180
    Like "*[Forms]![frmSOFSearch]![txtSOF]*"
    Code:
    Like "*" & Trim([Forms]![frmSOFSearch]![txtSOF]) & "*"
    www.MsAccessTips.com (Learn MS-Access Tips & Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

    All responses are based on Access 2003/2007

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    presumably
    Code:
    Like "'*" & Trim([Forms]![frmSOFSearch]![txtSOF]) & "*'"
    if the like construct is being used
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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