Results 1 to 5 of 5
  1. #1
    nashr1928 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    146

    Criteria filter

    I am using access 2003 and wish to add a search text field with a button to launch the query being filtered. The query name is Billing. I found this example online but cant seem to get it to work on my database. like "*" & [forms]![entries]![textcriteria] & "*"



    What do I use for control source in the text field? As it is If I click on the button then it pops up a new window with text field to enter the data to be filtered. I want to use the field That I put on the form to add data not the window that pops up.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    If I have understood correctly: You have a field on a form where you enter data and you want a query to run that matches that data?

    What type of data does the textbox contain? The criteria string you have above works well with partial entries, such as names, where the person wants John and Johnny and Johnson, etc, so enters "John" and all three records will be selected. You don't use that for dates or numbers or fully entered items.

    That criteria line should work in the query, I'm not sure why it isn't working.

  3. #3
    nashr1928 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    146

    criteria filter

    I have added a couple of attachments. It shows the automatic window that pops up when you launch the query with the button. If you leave it blank and enter then you get the full query view. If I enter anything in that text field window then I get a blank query with no data as you can see on the attachment. I want to be able to enter 2011 and ony get those records for that year or I want to enter the customer names or the instrument names and just get those records.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In your "Like" statement there is an error and the query cannot find the field you are referring to. Either the form is closed or else there is a spelling mistake - that is not the name of the form or that is not the name of the textbox. They have to match exactly otherwise the query cannot find it.

    If you are matching on Year then you do not use "Like", it will be equal to. The query field will be "xxname: Format(datefieldname,"yyyy")" and in the criteria you will put the form text box name with an equal sign (no quotes). Each of the fields mentioned above will either need its own query or else the one query needs to have "OR" criteria for each field - if date is equal or customer or... whatever. I don't know exactly how you want this to happen.

  5. #5
    nashr1928 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Apr 2010
    Posts
    146

    criteria filter cont.

    Well you have convinced me its more complex that I had thought. Um right now I'm using filter by selection from the form and it works well. I just wanted to try and put the execution on the form as a button instead of using a tool selection. Thank you for educating me on this subject.

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

Similar Threads

  1. Query: How To Filter Data In Criteria
    By netchie in forum Queries
    Replies: 1
    Last Post: 08-31-2011, 01:36 PM
  2. Filter SQL query by criteria
    By IdleJack in forum Access
    Replies: 2
    Last Post: 08-18-2011, 05:56 PM
  3. Apply Filter 2 criteria not applying
    By ahightower in forum Forms
    Replies: 4
    Last Post: 07-28-2011, 03:31 PM
  4. Criteria or Filter Issue
    By MichaelW in forum Queries
    Replies: 1
    Last Post: 07-06-2010, 01:43 PM
  5. Criteria or Filter for Query
    By Ryan in forum Queries
    Replies: 1
    Last Post: 08-29-2009, 11:50 PM

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