get results for previous 3 months VAT reasons (1 Viewer)

hullstorage

Registered User.
Local time
Today, 16:42
Joined
Jul 18, 2007
Messages
213
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
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:42
Joined
Feb 28, 2001
Messages
27,126
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/functions/date/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/functions/date/datepart.php
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:42
Joined
Sep 12, 2006
Messages
15,634
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.
 

Users who are viewing this thread

Top Bottom