Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7555473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:37:05+00:00 2026-05-30T11:37:05+00:00

In MS Access I am trying to filter to show only records from previous

  • 0

In MS Access I am trying to filter to show only records from previous week.
I have colums showing weeknumber based by record date.
Using DatePart("ww",Date(),2,2)-1 in criteria field works well if current week is not 1. It does not work to previous year.

How I can show only records from previous week or 2 weeks, even if it goes to previous year?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:37:06+00:00Added an answer on May 30, 2026 at 11:37 am

    For the most recent week of data, start with something like this …

    YourDateField Between (Date() -7) AND Date()
    

    That approach will not break when your target YourDateField range include dates from 2 years. Another advantage of that approach is the query can make use of an index on YourDateField, if you have one. In that case the db engine can examine the index to find which rows match your criterion and read only the matching rows instead of all rows in the record source. (If you don’t have an index on YourDateField, add one to see if it speeds up the query significantly. You can drop the index if it’s ineffective.)

    Conversely using a WHERE condition based on the DatePart() function will force the db engine to examine each and every row in the query’s record source. That can be a performance bottleneck which can be significant with a huge table, especially if it is a linked table which requires data be read across a network connection.

    Edit: I misunderstood what you wanted. For the the week which started on the previous Monday, I used this condition:

    Between Date() - ( 6 + Weekday(Date(), 2))
        AND Date() - Weekday(Date(), 2)
    

    The db engine will evaluate those expressions one time only when running the query, so while this approach is more complicated than what I first suggested, it can still offer the potential performance improvements over using DatePart() for every row in the data source.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to access Outlook 2007 from C#. I have installed the PIA
I am trying to import data from Access to Excel based on two parameters.
I am trying to access userdata I have sent from the server (using coldfusion)
I'm trying to only allow access to galleries by users who have permission to
I am trying to filter the only.sql files from given Directory path But it
I am trying to develop a DirectShow filter with internet access. When I try
Im trying to access a web service from a remote computer. I managed to
I am trying to access a view inside a splitter from my mainframe. At
I'm trying to filter all clients (using .htaccess) who try to access addresses containing
I'm trying to add some functionality from a plugin I have made into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.