What would i need to add to show the records from the next month aswell

Vitiositas

Registered User.
Local time
Today, 21:10
Joined
Oct 10, 2012
Messages
20
Hi guys, been browsing your forums for a long time, first time iv come across something i cant find that i need help with.

Basicly we run a report within our access database that shows the clients name and date of distrubution, currently it shows the data from the current month, I have been scratching my head and looking around for how to add the data for the next month aswell and have come up with nothing.
This is what we currently have that shows the data from the current month:

SELECT [basic details].* FROM [basic details] WHERE (((Month([DistribStart]))=Month(Date())) AND ((Year([DistribStart]))=Year(Date()))) ORDER BY [basic details].DistribStart, [basic details].[Client Name];

Any help or ideas are apreciated, and please make them as basicly as possible as i am not an access expert.

Edit: Fixed Formatting
 
Last edited:
Try replacing your current WHERE with this one..
Code:
WHERE (((Month([DistribStart]))=Month(Date()) OR ((Month(DateAdd("m",1,[DistribStart])))=Month(DateAdd("m",1,Date()))) AND ((Year([DistribStart]))=Year(Date())))
 
Last edited:
Thanks for the response, unfortunatly i get Syntax error (missing operator) in query expression. This is followed by the query
 
What is the DataType of the field [DistribStart]
 
Sorry.. It was missing another bracket.. Try this..
Code:
WHERE (((Month([DistribStart]))=Month(Date()) OR ((Month(DateAdd("m",1,[DistribStart])))=Month(DateAdd("m",1,Date())))) AND ((Year([DistribStart]))=Year(Date())))
 
I tryed that, no error this time, BUT it hasnt changed the results of the report, it still onlys shows those within this current month and not aswell as next month
 
Ouch.. I am so sorry... I figured out what was wrong.. try this.. I am sure this will work..
Code:
WHERE (((Month([DistribStart]))=Month(Date()) OR ((Month([DistribStart]))=Month(DateAdd("m",1,Date())))) AND ((Year([DistribStart]))=Year(Date())))
I was adding one month to the field as well.. we have the fields value already.. we only need to check if they will be equal to Next month..
 

Users who are viewing this thread

Back
Top Bottom