Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2015
    Posts
    7

    Unanswered: Include Like in forms filter

    Ms Access vba

    I have a datasheet form with various fields.
    All I would like to do is have the filters at the top of each field include “like” when selected.
    So when they select a filter it will always be “like” *filter selected* .
    I know there is a facility to use “contains” but just trying to make it easier for the user.
    The fields are also combo boxes so had problems with the data type.

    Appreciate your help.
    Regards
    Norm

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    496
    Provided Answers: 24
    in the filter code,

    me.filter = "select * from table where [field] like '*" & txtFilter & "*'"
    me.filterOn = true

  3. #3
    Join Date
    Aug 2015
    Posts
    7
    Thank you for your help.

  4. #4
    Join Date
    Aug 2015
    Posts
    7

    not working

    Cant get it to work.
    Tired onfilter and afterfilter event. Should it be in a different form event ?
    Thanks
    Norm

  5. #5
    Join Date
    Aug 2015
    Posts
    7

    txtfilter

    Is txtfilter a variable or MS Access reserved word ?

  6. #6
    Join Date
    Aug 2015
    Posts
    7

    not working

    Thanks for your help but getting a syntax error 3075 does not like my query

Posting Permissions

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