Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-07-2019, 05:25 AM   #1
hullstorage
Newly Registered User
 
Join Date: Jul 2007
Posts: 196
Thanks: 6
Thanked 1 Time in 1 Post
hullstorage is on a distinguished road
get results for previous 3 months VAT reasons

Hi all,

I have a query and report that shows invoices with invoice date obviously ?

My accountant wants data from the last 3 months records ?

March,April and May invoices and next time June, July and August

i want the criteria so code will simply show the last from months only and obliviously dont want to include this months invoices already raised

thanks guys

hullstorage is offline   Reply With Quote
Old 06-07-2019, 06:07 AM   #2
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,346
Thanks: 87
Thanked 1,642 Times in 1,524 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: get results for previous 3 months VAT reasons

You can select one date and then use DateAdd to get another date that is some number of days or months (or other interval) different from that date. Here is a link to DateAdd:

https://www.techonthenet.com/access/...te/dateadd.php

Note in particular that when you use DateAdd for an interval of months, it keeps the same day of the month in the result even though of course months have varying numbers of days. So if you pick the 1st of the month and add 3 months, you get a date on the 1st of the month.

It would be up to you to decide how to do the selection of the starting date because of course you might not ask for this report on the 1st of the current month if it wasn't a working day. So here is a link for the DatePart function that you could use to build date from pieces-parts.

https://www.techonthenet.com/access/...e/datepart.php
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is online now   Reply With Quote
Old 06-07-2019, 07:54 AM   #3
gemma-the-husky
Super Moderator
 
gemma-the-husky's Avatar
 
Join Date: Sep 2006
Location: UK
Posts: 13,769
Thanks: 55
Thanked 1,022 Times in 988 Posts
gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all gemma-the-husky is a name known to all
Re: get results for previous 3 months VAT reasons

I would use a form, and select the dates you want, so you can use

between format(datea,"long date") and format(dateb,"long date")

others will give a different suntax to "long date" - but you need a format in the UK.

secondly, I would use a function to read the date (as above) - if you use a form reference you will probably get a 3061 (I think) error.

-----
Either that, or manually enter the dates you want in the query

but note that if you enter #01/04/2019# it might work as #Jan 4th 2019#. Just be prepared for that.

__________________
Dave (Male!)
Gemma was my dog

if a poster helps you, please click the scales at the bottom left of this posting, or use the thanks button alongside.
gemma-the-husky is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Previous Months data simon4amiee Queries 9 03-19-2014 01:42 PM
Date Criteria: Query Previous 12 Months, including months with no data molly2013 Queries 2 03-22-2013 12:16 PM
Need to create a parameter query to show the previous months results. browninaz Queries 17 12-12-2012 08:24 PM
Previous months in months order sushmitha Queries 5 11-20-2008 03:21 PM
Previous 12 months IanT Queries 3 03-20-2002 10:56 AM




All times are GMT -8. The time now is 06:52 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World