Page 3 of 3 FirstFirst 123
Results 31 to 40 of 40
  1. #31
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Probably have to provide db for analysis.

    I never use expression builder.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  2. #32
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Here is the sanitized copy of the database. The issue deals with the Sites Navigation sub-form. The text field [TxtID], in question, with the Data Source expression, is in the header of the Sites Navigation sub-form.

    The objective is to have the current record in the [Assets_Trans_Sites] sub-form, bring up the corresponding Asset record in the [Site_Asset] detail form below, for viewing and editing, starting with the first [Asset_Trans-Sites], (displayed as Assets) record in the middle form, and changing as I browse through the [Assets_Trans_Sites] form records.

    To get something to work with, search for a Site in the Assets Navigation sub-form header, GoTo combo-box, for "Lake Mnt-FS". That will bring up a list of "Assets" obtained from the [Assets_Trans_Sites] form, which includes some details from the Assets table records.

    FYI: I have two other similar transaction sub-forms, with differing content: [Assets_Trans_Assets] and [Assets_Trans_Mem], used in their respective contexts.

    When you open the db, it will default to the Members, ([SCATeam]) Navigation Sub-form.
    SCATeam_Cleaned.zip

  3. #33
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Assets tab GoTo does not list sites, it lists assets. Filter_Site lists sites. Its click event triggers input popup because it incorrectly references Assets_Trans.Site. The code is trying to set filter on Site field (Me.Filter = …). Site field is not in table Assets which is the RecordSource. So what is purpose of this combobox? Perhaps code should be:

    Code:
    Private Sub Filter_Site_Click()
        Me.Assets_Trans_Assets.Form.FilterOn = False
        Me.Assets_Trans_Assets.Form.Filter = "[Site_ID] = " & Me.Filter_Site
        Me.Assets_Trans_Assets.Form.FilterOn = True
    End Sub
    The code runs and can see filter of the subform is set. However, Assets_Trans_Assets subform container Master/Child links restrict records to the Asset of its parent form. So setting filter on Site really doesn't make sense.

    If Assets and Assets_Trans have a 1-to-1 relationship, why split into two tables?

    You need to run Debug>Compile and fix other errors.

    However, none of this seems to address your original question of "How to filter a main form from a value in a subform based on a combo control in the main form", which is itself a confusing statement.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #34
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    I am not sure why you went to the Assets tab, as the issue relates to the Sites tab. Yes, the GoTo box on the Assets tab allows selection of Assets. However, the GoTo box on the Sites tab allows selection of Sites.
    But since your are there, I'll try to address your concerns related to the Assets Tab.
    Assets Tab:
    The Asset_Group form on the Assets Navigation Tab, filters assets grouped with the current asset tracking record, based on the text field Group. The Master and Child fields of the Asset_Groups sub-form are both set to [Group], which automatically filters the the assets for the Asset_Groups sub-form. When I click on the BarCode field in the Asset_Groups sub-form, it moves that asset to the Assets Navigation sub-form, to view and edit all the details of that Asset.

    The Site Filter on the Assets Navigation Form doesn't work. Feedback I got earlier, indicated it cannot work this way, so I had abandoned this approach, but had neglected to delete this feature in the meantime. That is why I switched to work with the assets by site, from the Sites Navigation sub-form instead. It makes more sense to do it there anyway, plus I can see all the assets assigned to the site in the Assets_Trans_Sites continuous sub-form, which is nicer, than just being able to see one at at time under the Assets Tab.

    Assets_Trans table is in a many-to-one relationship with the Assets table. It currently appears to be in a 1-1 relationship, only because I initially have just one Assets_Trans record for each Asset. That will change over time, as the status of assets change. I intend for the Assets_Trans table to keep a history of changes to asset statuses. The assets need a lot of work yet, to get them properly inventoried and documented. I hope that clarifies your concerns with the Assets Navigation sub-form.

    Please, now, go to the Sites Navigation tab and look at the issue with the [TxtID] data source expression. To get a list of Assets in the middle screen to play with, select the "Lake Mnt-FS" site from the GoTo combo-box. Please review my previous post to understand what I would like to have happen.
    Thank you for taking your time to help me.

  5. #35
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I went to Assets tab because instructions in post 32 said to (emphasis added):
    To get something to work with, search for a Site in the Assets Navigation sub-form header
    The Assets form on the Sites Navigation tab is installed via a normal subform container.
    Must reference the subform container control name: =[Assets_Trans Subform]![Asset_ID]

    Since the textbox is on the Sites Navigation tab at same level as the subform container, full Navigation form path is not needed.

    I use a schema like ctrAssets to name subform container controls.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #36
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Oops! Sorry for the unintended miss-direction in my previous instructions. I Entered the expression as indicated and it works wonderfully. Thank you so very much.

  7. #37
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Again, thanks for your help.
    I have two questions related to this discussion.
    1) What did I say to miss-lead you into a solution involving a full Navigation path.
    2) How did you come up with Assets_Trans Subform, as the syntax for the name of the subform container control? I have tried to find it, but I guess I do not know where to look. As far as I know, the container name is Assets_Trans_Sites. The only Assets_Trans I know of, is the Table with that name.

  8. #38
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Never mind my 2nd question in my post this morning, about the container control name. I just found it. One must get the boarder of the container highlighted, in order to see the container name. Now, I understand what you mean by the Container control. To me, I had just thought it was the form itself. I had no idea they were two different objects, which is why I was confused when you talked about the container control name.

  9. #39
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    As for 1), my misunderstanding of where the textbox was positioned, not necessarily due to anything you said.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  10. #40
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    While this turned into a protracted conversation, in the end, it was an import learning conversation for me. I learned a lot from it, that will be very helpful in the future. So, thanks for your patience.

Page 3 of 3 FirstFirst 123
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 07-05-2017, 11:31 AM
  2. Filter main form based on subform data
    By Varda in forum Forms
    Replies: 9
    Last Post: 01-02-2015, 10:40 PM
  3. Replies: 3
    Last Post: 06-02-2012, 07:39 PM
  4. Subform Filter based on Main Form Information
    By james.carpenter2 in forum Forms
    Replies: 0
    Last Post: 02-16-2011, 09:55 PM
  5. Replies: 1
    Last Post: 11-16-2010, 08:42 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