Share via

Between Dates

Anonymous
2024-08-05T21:43:00+00:00

I have two tables.

Table 1 (tblPeriod) contains 3 fields - "Period", "PeriodStart", "PeriodEnd".

Though the period is usually a given month (eg. July 2024), the start date may differ than the actual date the month starts and ends. (accounting purposes).

Table 2 (tblSales) contains sales info which includes the sales date.

All sales will into a particular period (month).

So if the sale is dated July 8, 2024, it should be in the period July 2024.

I have built a query to capture this info but it it does not work (I knew it wouldn't)

I tried DLookup("Period","tblPeriod","InvoiceDate between PeriodStart and PeriodEnd).

I know my problem is the criteria.

Help me please.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-08-05T22:20:29+00:00

    This is perfect.

    Thank you very much

    Was this answer helpful?

    0 comments No comments
  2. HansV 462.6K Reputation points
    2024-08-05T22:04:04+00:00

    Try

    DLookup("Period","tblPeriod","PeriodStart<=#" & Format([InvoiceDate], "yyyy-mm-dd") & "# AND PeriodEnd>=#" & Format([InvoiceDate], "yyyy-mm-dd") & "#")

    Was this answer helpful?

    0 comments No comments