Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Select from range of dates

Select from range of dates

Select from range of dates

I just can't seem to find the answer that should be fairly easy. I have a date in one Production table and I need to find out which period it falls in from my Accounting period table. An example from the production table would be 2/23/2017 and I need to select the proper period from the following:
ActgIndx startperiod end period
1 12/26/2016 1/31/2017
2 2/1/2017 2/28/2017
3 3/1/2017 3/27/2017

The result for 2/23/2017 should be 2.
I've tried numerous things, but keep drawing a blank.
Appreciate any direction, thanks.

Thanks for the help.

RE: Select from range of dates

Use two tables in design view, without any linking, required production date within any of existing accounting periods:
    ProductionDate, ActgIndx
    Production, AccountingPeriod
    [ProductionDate] Between [StartPeriod] And [EndPeriod] 


RE: Select from range of dates

You may also try:

Select ActgIndx From AccountingPeriod
Where (Select ProductionDate From Production
        Where <condition>)
 Between StartPeriod And EndPeriod 

---- Andy

There is a great need for a sarcasm font.

RE: Select from range of dates

Thank you, I ran them both, and each one worked. Made my day a lot better.

Thanks for the help.

RE: Select from range of dates


Give some kudos by clicking the "Great post!" link. This lets us know the thread is closed successfully and honors the helpers.

Hook'D on Access
MS Access MVP 2001-2016

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close