Results 1 to 5 of 5
  1. #1
    erickfloyd's Avatar
    erickfloyd is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2017
    Posts
    18

    How can I set a "CONTAINS" filter from query in a form.

    Hi, ActuallyI'm just call the query field from the form textbox, but I need use asterisk before and after the search word as follow




    Click image for larger version. 

Name:	CONTAIN SEARCH.png 
Views:	17 
Size:	248.1 KB 
ID:	31262

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    qsLikeQry= select * from table where [contenga] like forms!myForm!txtContenga

    (but note, this wont work when you DONT use asterisks, so you may need an IF)

    Code:
    IF instr(txtContenga,"*")>0 then
       docmd.Openquery "qsLikeQry"
    else
       docmd.Openquery "qsExactQry"
    endif

  3. #3
    erickfloyd's Avatar
    erickfloyd is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2017
    Posts
    18
    Thanks, but I'm Still without Known where should I Put the query column name that i want to search


    IF instr(Text97,"*")>0 then
    docmd.Openquery "SADOS_CONT"
    else
    docmd.Openquery "SALDOS_CONT"
    endif


    These only open the query "SALDOS_CONT" but don't search or filter tha column that i want.

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Try Like "*" & forms!formname!fieldname & "*"

  5. #5
    erickfloyd's Avatar
    erickfloyd is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2017
    Posts
    18
    Thank you, that's finally works.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-28-2017, 12:29 PM
  2. Replies: 3
    Last Post: 07-07-2016, 12:22 PM
  3. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  4. Replies: 1
    Last Post: 02-05-2015, 05:41 PM
  5. Replies: 4
    Last Post: 01-22-2015, 10:30 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