DateAdd Function for and ENTIRE Month

C

CBender

I ahve a query where I want to select date data for the entire month. This I
can easily do using the following format:

Field: Month: Month([RevicedDateShipInv_PGI])
Criteria: Month(Date())

This provides me with every order within the current month.

However, when I try to select the same date information for the following
month using the DateAdd function as follows I get NO results:

Field: Month: Month([RevicedDateShipInv_PGI])
Criteria: DateAdd("m",+1,Month(Date()))

Can anyone tell me what I am doing wrong??


Thanks,

Chip
 
K

KARL DEWEY

DateAdd("m",+1,Month(Date()))
You are trying to add a months worth of days to the month number -
month=3 30+3 = 33 and that does not match next month number
 
J

John Spencer

Criteria should be

Month(DateAdd("m",1,Date()))

One problem with that is you are going to get the month for EVERY year.
If that is what you want, then this is no problem.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
C

CBender

Karl,

Thank you. I already understand that I am writing the wrong code because I
am not getting ANY results much less the results I want. I want to extract
all of the records for the following month in my query. I am not a
programmer and am self taught in MS Access so I am very much behind the
learning/knowledge curve when it comes to resolving coding issues. Can you
provide me with the CORRECT code I should be using?


Thank You,

Chip


--
Charles Bender
MTU Detroit Diesel


KARL DEWEY said:
DateAdd("m",+1,Month(Date()))
You are trying to add a months worth of days to the month number -
month=3 30+3 = 33 and that does not match next month number

--
KARL DEWEY
Build a little - Test a little


CBender said:
I ahve a query where I want to select date data for the entire month. This I
can easily do using the following format:

Field: Month: Month([RevicedDateShipInv_PGI])
Criteria: Month(Date())

This provides me with every order within the current month.

However, when I try to select the same date information for the following
month using the DateAdd function as follows I get NO results:

Field: Month: Month([RevicedDateShipInv_PGI])
Criteria: DateAdd("m",+1,Month(Date()))

Can anyone tell me what I am doing wrong??


Thanks,

Chip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top