Results 1 to 4 of 4
  1. #1
    Back2Basics is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2010
    Posts
    28

    Find Parent form record base don subform search criteria

    Hi

    I have a form with a subform. the form contains the following fields:

    Customer
    Site Reference
    Area
    Contact

    The subform then displays all of the relevant items for that customer and site. So if a customer has 2 sites they will have 2 records in the parent form and each one will display the items relevant for either site. What I am hoping to do is to allow users to search on the 'Item_Ref' in the subform so that it will go to the customer record where that item reference is found. Item reference are unique, no item has the same reference as another.

    Parent form name: frm_cus_full
    subform name: sbfrm_item

    The linked attribute is called Site_ID on both forms.



    TIA

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    The OnCurrent event of the subform occurs when you click on a row - at that point you can filter the main form based on the information of that row. Or you can use a button.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    you wouldnt search the subform, youd search the subform's data, the table.

    a button on the form would open a param query.
    this query would pull data from the subtable using the key in the parent table.
    select * from subTable where [key]=forms!frmParent!txtKey and [field]=[enter search value]

  4. #4
    Back2Basics is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Feb 2010
    Posts
    28
    Thanks Ranman

    I'm quite new to this so is it possible to fill in the details using my form and subform names?

    Form: frm_cus_details
    Subform: sbfrm_item
    Field: Item_Ref

    I'm not sure what 'subTable' and 'key' would refer to in your expression? Also, would I put this in the expression or the code builder? As I say, prey new to all of this.

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

Similar Threads

  1. Replies: 4
    Last Post: 02-05-2016, 02:32 PM
  2. Replies: 11
    Last Post: 02-22-2015, 01:25 PM
  3. Replies: 11
    Last Post: 11-19-2013, 09:03 AM
  4. Replies: 4
    Last Post: 05-17-2011, 06:56 AM
  5. Replies: 1
    Last Post: 12-22-2010, 01:28 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