Results 1 to 6 of 6
  1. #1
    treebark is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    10

    Question Using subform criteria to search the main form data

    So my subform is an editable table where I can put multiple different columns of data:
    ID, Order Number, User Name, User Location



    I want to setup an apply filter search button so that when I enter multiple IDs or multiple Order Numbers and click the macro apply filter button it filters the main forms data based on all values in those columns. I have a button on the main form with an applyfilter macro that works great with one value, but it doesn't like the subform values as the filter criteria.

    Thanks as always

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you want another table, say: tPicked
    this would hold the many chosen IDs (I use a form so the user can dbl-click it)
    In your main form query, join the tPicked table to your data and only these items will show.
    The subform is bound to the main form so you get those too.

    you can just manually enter data into the tPicked table, or use a form (below) to help:
    Click image for larger version. 

Name:	pick state-lbl.png 
Views:	11 
Size:	34.2 KB 
ID:	31744

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by treebark View Post
    So my subform is an editable table where I can put multiple different columns of data:
    ID, Order Number, User Name, User Location

    I want to setup an apply filter search button so that when I enter multiple IDs or multiple Order Numbers and click the macro apply filter button it filters the main forms data based on all values in those columns. I have a button on the main form with an applyfilter macro that works great with one value, but it doesn't like the subform values as the filter criteria.
    The subform should NOT have a Main form/Child form relationship.
    I never use macros, only VBA.
    But using VBA, you could create a filter string and apply it to the main form. Since you are using a table, you would open a record set based on that table and build the filter string "on-the-fly", then apply it.

    Because you want a filter that "filters the main forms data based on all values in those columns", it will be complicated.
    One field "ID" is easy. Four fields get complicated fast.



    BTW, "ID" is a poor field name.
    And shouldn't have spaces in object names.

  4. #4
    treebark is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    10
    Quote Originally Posted by ssanfu View Post



    BTW, "ID" is a poor field name.
    This is just an example, I cannot reveal my actual data. I'm well aware that is a terrible field name

  5. #5
    treebark is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Oct 2017
    Posts
    10
    What does the data macro look like for the Accept button?

  6. #6
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by treebark View Post
    This is just an example, I cannot reveal my actual data. I'm well aware that is a terrible field name
    Great! As long as you know. I see so many dBs that have "ID" as the PK field in EVERY table.

    Good luck with your project.......

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

Similar Threads

  1. Replies: 7
    Last Post: 07-14-2017, 01:14 PM
  2. search main form using the values in the subform
    By haritbhasin in forum Forms
    Replies: 1
    Last Post: 10-23-2012, 11:48 PM
  3. Main form running a search on Subform
    By Briansa in forum Access
    Replies: 1
    Last Post: 09-20-2012, 10:29 AM
  4. Replies: 3
    Last Post: 08-22-2012, 03:28 AM
  5. Replies: 4
    Last Post: 07-11-2012, 10:31 AM

Tags for this Thread

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