Solved

Date Criteria in Access Query

Posted on 2016-07-25
3
57 Views
Last Modified: 2016-07-25
I need to set a date criteria in my query but not sure how to set it up. I need it to be between the current date and the same date last year so it captures a rolling year date range. Any ideas on how I would set this up as the criteria?
0
Comment
Question by:Lawrence Salvucci
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41727577
Hi,

pls try

Between DateAdd("yyyy",-1,Date()) + 1 And Date())

Regards
1
 
LVL 1

Author Closing Comment

by:Lawrence Salvucci
ID: 41727582
Perfect! Thank you very much!
0
 
LVL 14

Expert Comment

by:wsh2
ID: 41727591
Dim strSQL as String
strSQL = _
    "SELECT * " & _
    "  FROM [MyTable] " & _
    " WHERE [MyTable].[MyDate] >= #12/31/2014# " & _
    "   AND [MyTable].[MyDate] <= #04/22/2015# "

Open in new window


OR

Dim dte1st as Date: dte1st = #12/31/2014#
Dim dte2nd as Date: dte2nd = #04/22/2015#
Dim strSQL as String
strSQL = _
    "SELECT * " & _
    "  FROM [MyTable] " & _
    " WHERE [MyTable].[MyDate] >= #" & dte1st & "# " & _
    "   AND [MyTable].[MyDate] <=  #" & dte2nd & "# "

Open in new window

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question