Query Criteria to show data that will be expiring in 3 months (1 Viewer)

ivonsurf123

Registered User.
Local time
Yesterday, 17:57
Joined
Dec 8, 2017
Messages
69
Hello,


Looking for a criteria to pull data that will be expiring in 3 months from every 5th of the month.


All that I find is to pull past data:


[FONT=&quot]Between DateAdd("m",-3,Date()) And Date()[/FONT]
[FONT=&quot]
[/FONT]
[FONT=&quot]If I do:[/FONT]


[FONT=&quot]Between DateAdd("m",-3,[EndDate]) And Date()[/FONT]
[FONT=&quot]
[/FONT]
[FONT=&quot]Will pull data from the end of may 2019 through year first January2099[/FONT]
[FONT=&quot]Any help will be appreciate it. Thank you.
[/FONT]
[FONT=&quot]
[/FONT]
[FONT=&quot][/FONT]
[FONT=&quot][/FONT]
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:57
Joined
Oct 29, 2018
Messages
21,494
Hi. This one should pull dates between today and 3 months from today.
Code:
[EndDate] Between Date() And DateAdd("m",3,Date())
Not sure how to add the 5th of the month in there yet.
 

ivonsurf123

Registered User.
Local time
Yesterday, 17:57
Joined
Dec 8, 2017
Messages
69
Thank you so much! That's closer...It returns from May 31st 2019 through July 31, 2019, which is correct on that query, but to return the data expiring in 3 months would be data for July 31 st showing only, how can I do that to view only that data?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:57
Joined
Oct 29, 2018
Messages
21,494
Thank you so much! That's closer...It returns from May 31st 2019 through July 31, 2019, which is correct on that query, but to return the data expiring in 3 months would be data for July 31 st showing only, how can I do that to view only that data?
How about?
Code:
[EndDate] = DateAdd("m",3,Date())
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:57
Joined
Sep 21, 2011
Messages
14,350
How about

Code:
Between DateAdd("m",-3,DateSerial(Year(Date),Month(Date),5)) AND DateSerial(Year(date),Month(date),5)
 

ivonsurf123

Registered User.
Local time
Yesterday, 17:57
Joined
Dec 8, 2017
Messages
69
@Gasman return the last 3 months no data expiring in 3 months from today's



Between DateAdd("m",-3,DateSerial(Year(Date),Month(Date),5)) AND DateSerial(Year(date),Month(date),5)




@ theDBguy Return an empty table
[EndDate] = DateAdd("m",3,Date())
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:57
Joined
Oct 29, 2018
Messages
21,494
@Gasman return the last 3 months no data expiring in 3 months from today's

Between DateAdd("m",-3,DateSerial(Year(Date),Month(Date),5)) AND DateSerial(Year(date),Month(date),5)

@ theDBguy Return an empty table
[EndDate] = DateAdd("m",3,Date())
Hi. It's hard to say why or what's happening without being able to see your data. Does the [EndDate] field contain a time component?
 

Gasman

Enthusiastic Amateur
Local time
Today, 01:57
Joined
Sep 21, 2011
Messages
14,350
You are adding 3 months. ?
I thought you wanted the last 3 months from the 5th?

? DateAdd("m",-3,DateSerial(Year(Date),Month(Date),5))
05/02/2019


@Gasman return the last 3 months no data expiring in 3 months from today's



Between DateAdd("m",-3,DateSerial(Year(Date),Month(Date),5)) AND DateSerial(Year(date),Month(date),5)




@ theDBguy Return an empty table
[EndDate] = DateAdd("m",3,Date())
 

ivonsurf123

Registered User.
Local time
Yesterday, 17:57
Joined
Dec 8, 2017
Messages
69
It is to check every 5th of the month data that will be expiring in 3 months, that's the query I need, but I think I cam work with TheDBGuy criteria:
Thank you everyone!

[EndDate] Between Date() And DateAdd("m",3,Date())
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 17:57
Joined
Oct 29, 2018
Messages
21,494
It is to check every 5th of the month data that will be expiring in 3 months, that's the query I need, but I think I cam work with TheDBGuy criteria:
Thank you everyone!

[EndDate] Between Date() And DateAdd("m",3,Date())
Hi. Good luck. Let us know if you get stuck. Cheers!
 

Users who are viewing this thread

Top Bottom