H
hom370
On a form I have a combo where a month is entered. It shows the month names
in column one, but it is bound to column two where each month's corresponding
number is, ie Jan=1, Feb=2, etc. So selecting April returns 4. Also on the
form I have a text box where a number is entered and used as the date of the
month in the aforementioned combo box.
I pull those numbers (month number from the combo and date number from the
text box) together using dateserial() and I put that into a dateadd()
statement to find a date previous to the one entered. The date I'm looking
for is the day after the same date last month. For instance, April 31 should
return April 1 and June 15 should return May 16. Here's what I have been
working with:
DateAdd("d",0,DateSerial(Year(Date()),[LastYearMonthToMatch]-1,[LastYearMatchDateReady]+1))
The problem is that it is inconsistent. When Oct 31 is entered, it returns
Oct 2, but should return Oct 1. And when March 31 is entered, it returns
March 4 instead of March 1.
Is there a way to get the results I'm needing?
Thanks!
in column one, but it is bound to column two where each month's corresponding
number is, ie Jan=1, Feb=2, etc. So selecting April returns 4. Also on the
form I have a text box where a number is entered and used as the date of the
month in the aforementioned combo box.
I pull those numbers (month number from the combo and date number from the
text box) together using dateserial() and I put that into a dateadd()
statement to find a date previous to the one entered. The date I'm looking
for is the day after the same date last month. For instance, April 31 should
return April 1 and June 15 should return May 16. Here's what I have been
working with:
DateAdd("d",0,DateSerial(Year(Date()),[LastYearMonthToMatch]-1,[LastYearMatchDateReady]+1))
The problem is that it is inconsistent. When Oct 31 is entered, it returns
Oct 2, but should return Oct 1. And when March 31 is entered, it returns
March 4 instead of March 1.
Is there a way to get the results I'm needing?
Thanks!