Results 1 to 6 of 6
  1. #1
    Baldur is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2023
    Posts
    2

    Filter a Form on a Field in a Subform

    I am looking for a VBA code to filter a form based on a field in a subform.


    The system in question is a (simple) CRM system.
    The tables in question are:
    CONTACTS (Customers/prospects).
    and CATEGORY (customer category such as Prospect, Customer and 4 other fields)
    The Contacts form draw its records from the CONTACTS table and
    and the subform from the table CATEGORY.
    The CATEGORY table fields: Category and Service are the fields I want to be able to filter on to focus on all the prospects that might be interested in a particular service.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Not understanding relationship between CONTACTS and CATEGORY. If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  3. #3
    Baldur is offline Novice
    Windows 10 Office 365
    Join Date
    Jan 2023
    Posts
    2
    Category is the subform to CONTACTS.
    Contacts can be of different category/types. Example; Customer, prospects and 3 other types

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,570
    Normally it is the other way around?

    However, to refer to subforms and their controls http://access.mvps.org/access/forms/frm0031.htm
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I would expect CATEGORY to be a lookup table and source for a combobox to populate a field in CONTACTS. This is why I am confused as to why you have it as a subform.
    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. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,425
    What June7 said. Plus if this means that there is a field for every category type, the table is designed like a spreadsheet.
    customer category such as Prospect, Customer and 4 other fields
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 2
    Last Post: 10-29-2019, 02:24 PM
  2. Replies: 3
    Last Post: 03-23-2016, 04:00 PM
  3. Combobox subform filter: text field vs. number field
    By Alhassani in forum Programming
    Replies: 2
    Last Post: 07-08-2014, 10:04 AM
  4. Replies: 5
    Last Post: 03-15-2013, 10:53 PM
  5. Replies: 1
    Last Post: 08-16-2012, 01:51 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