Currently Month and Next Month

DaRTHY

Registered User.
Local time
Yesterday, 21:14
Joined
Mar 6, 2015
Messages
90
Hello guys,

I need to Criteria between currently Month and Next Month. (we are in April because of this im giving this example : 01.04.2015-31.05.2015)

I tried this code but its not working :

Dateadd("M") between DateAdd("M"+1)


if you have a solution please share to me

Ty.
 
Last edited:
How about,
Code:
BETWEEN [URL="http://www.techonthenet.com/access/functions/date/dateserial.php"]DateSerial[/URL]([URL="http://www.techonthenet.com/access/functions/date/year.php"]Year[/URL](Date()), [URL="http://www.techonthenet.com/access/functions/date/month.php"]Month[/URL](Date()), 1) AND DateSerial(Year(Date()), Month(Date()) + 2, 0)

? DateSerial(Year(Date()), Month(Date()), 1)
01/04/2015 
? DateSerial(Year(Date()), Month(Date()) + 2, 0)
31/05/2015
 
I copied your first code "BETWEEN DateSerial(Year(Date()), Month(Date()), 1) AND DateSerial(Year(Date()), Month(Date()) + 2, 0)"

but its not working first error was Sytax and i used "" and now there is a new error :
Data type mismatch in criteria expression.
 
So my guess is the field you are trying to use the criteria is not Date type is it? It is of type Text?

If so, you understand why the error !
 
Date Type is Date/Time
its correct.
a million dollars question : if date type is correct why do i get this error message :(
 
i did not write to sql code im using design view. Sql code seems so funny now :D

and i cant send them because its forbidden from company :S
 
you may need to replace the , by ; depending on your regional settings.
 
I copied your first code "BETWEEN DateSerial(Year(Date()), Month(Date()), 1) AND DateSerial(Year(Date()), Month(Date()) + 2, 0)"

but its not working first error was Sytax and i used "" and now there is a new error :
Data type mismatch in criteria expression.

This post suggests to me that you put " around the statement , they are not needed.

Brian
 
BETWEEN DateSerial(Year(Date()); Month(Date()); 1) AND DateSerial(Year(Date()); Month(Date()) + 2; 0)

Okey this time i wrote ; instead of , now i dont get any error. But it shows nothing...

shall i write this part too ??

? DateSerial(Year(Date()), Month(Date()), 1) 01/04/2015 ? DateSerial(Year(Date()), Month(Date()) + 2, 0) 31/05/2015

the problem is, i want to this function automatically update itself. For example next month i ll need this 1.5.2015 to 31.06.2015
 
Please post the Full SQL, with some sample data. If everything fails, please post a stripped DB.

How to Upload a Stripped DB.

To create a Sample DB (to be uploaded for other users to examine); please follow the steps..

1. Create a backup of the file, before you proceed..
2. Delete all Forms/Queries/Reports that are not in Question (except the ones that are inter-related)
3. Delete auxiliary tables (that are hanging loose with no relationships).
4. If your table has 100,000 records, delete 99,990 records.
5. Replace the sensitive information like Telephone numbers/email with simple UPDATE queries.
6. Perform a 'Compact & Repair' it would have brought the Size down to measly KBs..
7. (If your Post count is less than 10 ZIP the file and) Upload it..

Finally, please include instructions of which Form/Query/Code we need to look at. The preferred Access version would be A2003-A2007 (.mdb files)
 
Its working. Ive been worked on DB and I found my fault. Sorry about that

Thank you so much

Problem Solved. :D :cool:

you can close the Thread
 

Users who are viewing this thread

Back
Top Bottom