Results 1 to 6 of 6
  1. #1
    Chky071 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2015
    Posts
    25

    Filter a continuous form using a combo box

    I am running access 2007 and have a continuous form that I am trying to filter. The table that I am pulling the data from has the following fields: Order_Date, Order_number, Model.

    I want to filter based on Order_Date.

    I tried creating an "after update" Macro builder on my combo box and using "Apply Filter" but I cannot seem to get my syntax right.



    Filter is the name of my combo box

    Here is my current setup:
    Filter Name:
    Where Condition: [Order_Date] Like [Filter]
    Control Name:

    However whenever I select a new date from my combo box it asks me to "Enter Parameter Value" for Filter, which I don't understand because my combo box name is Filter. I would think they would link up.

    Any help would be appreciated

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Me.filter = "[orederDate]=#" & cboDate & "#"
    me.filterOn = true

  3. #3
    Chky071 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2015
    Posts
    25
    ranman256 thanks for you help.

    Inside of design view I clicked on "view code" I added the text that you recommended, but changed the fields to match my form. However when I select a date from the combo box it does nothing.

    Here is the code:
    Option Compare Database


    Me.Filter = "[BUILD_DATE]=#" & Filter & "#"
    Me.FilterOn = True

    "Option Compare Database" was there when I opened "view code"
    "Filter" is the name of my combo box so I put it in place of cboDate

    Thanks

  4. #4
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    'filter' is a reserved word for Access. It is never a good idea to give your fields/controls a reserved name. You can rename your filter combobox to something like cboFilter.

  5. #5
    Chky071 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2015
    Posts
    25
    Quote Originally Posted by NoellaG View Post
    Hi,

    'filter' is a reserved word for Access. It is never a good idea to give your fields/controls a reserved name. You can rename your filter combobox to something like cboFilter.
    Thanks for your help. I made the change and it still does nothing. I inputed the code and when I change my combo box nothing happens. Any help would be appreciated.

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    It seems you have placed your code outside of a subprocedure and close to the top of the module, within the module header.

    Your code should go in an event handler. To create a subprocedure for the click event of a command button, use the properties sheet while in design view. The Event tab within the properties sheet lists all of the available event handlers for the corresponding Object/Control.

    Select your Command Button by clicking it and highlighting it. Locate the On Click event handler. To the right of the event, click the ellipses (...) and select the option for Code Builder. Click OK. Paste your code within the event subprocedure, before the line of code, "End Sub".

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

Similar Threads

  1. Replies: 3
    Last Post: 07-21-2014, 06:08 AM
  2. Replies: 3
    Last Post: 09-23-2013, 06:42 AM
  3. Replies: 1
    Last Post: 11-24-2011, 07:45 AM
  4. Filter a Continuous Form
    By michel_annie22 in forum Forms
    Replies: 7
    Last Post: 11-09-2011, 07:34 AM
  5. Continuous Subforms Filter Dependant Combo
    By BigBear in forum Forms
    Replies: 0
    Last Post: 04-19-2009, 08:13 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