Results 1 to 2 of 2
  1. #1
    drinkwater is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    1

    How to filter a form by a query that is based on 2 tables?

    Hi
    Hope some experts can help me with this simple question.
    I have two tables in my database (too many variables to be able to put into one big table): table A and table B (one to one relationship). I created a form with table A as source table, and created a subform on it with Table B as the subform data source. Now I want to filter the forms (both main and sub forms) by a query based on both table A and table B. For example I want to choose records with tableA_var1="eat" and tableB_var1="Lunch", does anyone know how to write the VBA codes for this?
    Thanks.


    Drinkwater

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    How would you use a query to filter forms? Use comboboxes on form to input parameters. Use these parameters to set filters for the forms. Filter each form with respective criteria. For one approach, review tutorials at http://datapigtechnologies.com/AccessMain.htm especially the two on Search/Filter forms in the Access Forms: Tips & Techniques section.

    You have more than 255 fields? Never seen a table that big. Possibly your data structure is not normalized.
    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.

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

Similar Threads

  1. How to Filter a Form Based on checkmarks?
    By Silverhand4e in forum Forms
    Replies: 3
    Last Post: 01-09-2012, 04:47 PM
  2. Replies: 1
    Last Post: 11-16-2010, 08:42 AM
  3. Replies: 1
    Last Post: 02-03-2010, 08:17 AM
  4. filter form based on combo box
    By lloyddobler in forum Forms
    Replies: 8
    Last Post: 09-10-2009, 07:33 AM
  5. Form Based Query/Filter
    By Micon in forum Access
    Replies: 0
    Last Post: 11-07-2008, 09:25 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