Results 1 to 7 of 7
  1. #1
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    Use a sub form sub to filter

    I have a form with 3 sub forms. I will refer to them as SubformA, SubformB, SubformC and the master form as Master.

    SubformA has its own sub form which I will call SubformAsub. On SubformAsub, using VBA , I would like to double click a field (integer) and have it filter SubformA for that value. I Just don’t seem to know how to do it Tried many things. Any help very much appreciated.

    Using Access 2007.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you can do it without any code : right click on the value, filter.
    (same amount of clicks)

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you can do it without any code : right click on the value, filter.
    (same amount of clicks)

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    Usual way is to reference the parent e.g. from a subform

    Parent.filter=“filter code here”

    Otherwise show what you have tried

  5. #5
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    [QUOTE=Ajax;477423]Usual way is to reference the parent e.g. from a subform

    Parent.filter=“filter code here”

    Otherwise show what you have tried


    This is what I have most recently tried:

    Forms!F_OwnsBoatNewEntry!F_Cust_Sub.Form.Filter = "idCUST= " & Me.idCust & ""

    F_OwnsBoatNewEntry is the master form.
    F_Cust_Sub is one of 3 sub forms on the master.
    F_CustSubSub is a subform of F_cust_Sub.
    I double click one of the entries on the F_CustSubSub to actuate the code.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    After you set it, you usually have to apply it if it hasn't been done prior. Perhaps after the filter setting line:
    Code:
    Forms!F_OwnsBoatNewEntry!F_Cust_Sub.Form.FilterOn = true
    I recall reading issues about altering form filter more than once but can't recall what the details were. Something about the first filter being re-applied if it wasn't removed first?
    EDIT - don't think you should have the trailing double double quotes though
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    Agree with micron, no double quotes at end and use filteron=true

    You can go your long route to identify the form, or you can use parent

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

Similar Threads

  1. Replies: 9
    Last Post: 02-24-2015, 11:19 AM
  2. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  3. Replies: 5
    Last Post: 02-07-2013, 12:21 PM
  4. Replies: 1
    Last Post: 08-16-2012, 01:51 PM
  5. Replies: 28
    Last Post: 03-08-2012, 06:47 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