Search code examples
ms-access-2010criteria

Show records from one table to another


I am trying to create criteria on a query so when I select the current Period into a combobox on a form the Dates will filter to only show dates between START and END (Located on a Table). For example, If I where to write

IF[PComboBox].[Text] = ([Period]) ([Period]) BETWEEN ([Start]) and ([End])

I have a table that contains 3 Fields, (Period) which is 26 records starting from 1. I have (Start) (End) which detail what date each period is between.

I then have another table which has all the client records and the start date for each job called. (Matter_OpenDate).

The criteria above is under Matter_OpenDate on the query.

The code is definitely very wrong but hopefully someone can understand it and help me out.

Hopefully this is understandable to everyone.


Solution

  • That could be:

    Select 
        * 
    From 
        TablePeriod, 
        TableMatter
    Where
        TablePeriod.Period = [Forms]![YourFormName]![PCombobox]
        And
        TableMatter.Matter_OpenDate Between TablePeriod.Start And TablePeriod.End