I have a report that pulls data for the previous three months, so, when I run it this month, it would pull data for May, June and July. It gets more complicated. We have a field called TRANSMONTH. This is a six charachter string that represents the month of the transaction. So, this report is pulling data for TransMonths 200105, 200106 and 200107. This is a little tricky to figure out since I need to compare a string with the Current Date. Below (sorry it's so long), is how I have put together the selection formula. It works GREAT on my machine, but it brings back NO data on another machine. If I comment it out, it runs fine. Is there some setting on my machine that might not be on the other machine that would cause this? Any other ideas?
If Month(CurrentDate) = 1
Then {TableName.TransMonth} In ((CStr(Year(DateAdd("m", -3, CurrentDate)))) & (CStr(Month(DateAdd("m", -3, CurrentDate))))) To ((CStr(Year(DateAdd("m", -1, CurrentDate)))) & (CStr(Month(DateAdd("m", -1, CurrentDate)))))
Else If Month(CurrentDate) In [2, 3]
Then {TableName.TransMonth} In [(((CStr(Year(DateAdd("m", -3, CurrentDate)))) & (CStr(Month(DateAdd("m", -3, CurrentDate)))))), (((CStr(Year(DateAdd("m", -2, CurrentDate)))) & (CStr(Month(DateAdd("m", -2, CurrentDate)))))), (((CStr(Year(DateAdd("m", -1, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -1, CurrentDate))))))]
Else If Month(CurrentDate) In 4 To 10
Then {TableName.TransMonth} In ((CStr(Year(DateAdd("m", -3, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -3, CurrentDate))))) To ((CStr(Year(DateAdd("m", -1, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -1, CurrentDate)))))
Else If Month(CurrentDate) In [11, 12]
Then {TableName.TransMonth} In ((CStr(Year(DateAdd("m", -3, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -3, CurrentDate))))) To ((CStr(Year(DateAdd("m", -1, CurrentDate)))) & (CStr(Month(DateAdd("m", -1, CurrentDate)))))
If Month(CurrentDate) = 1
Then {TableName.TransMonth} In ((CStr(Year(DateAdd("m", -3, CurrentDate)))) & (CStr(Month(DateAdd("m", -3, CurrentDate))))) To ((CStr(Year(DateAdd("m", -1, CurrentDate)))) & (CStr(Month(DateAdd("m", -1, CurrentDate)))))
Else If Month(CurrentDate) In [2, 3]
Then {TableName.TransMonth} In [(((CStr(Year(DateAdd("m", -3, CurrentDate)))) & (CStr(Month(DateAdd("m", -3, CurrentDate)))))), (((CStr(Year(DateAdd("m", -2, CurrentDate)))) & (CStr(Month(DateAdd("m", -2, CurrentDate)))))), (((CStr(Year(DateAdd("m", -1, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -1, CurrentDate))))))]
Else If Month(CurrentDate) In 4 To 10
Then {TableName.TransMonth} In ((CStr(Year(DateAdd("m", -3, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -3, CurrentDate))))) To ((CStr(Year(DateAdd("m", -1, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -1, CurrentDate)))))
Else If Month(CurrentDate) In [11, 12]
Then {TableName.TransMonth} In ((CStr(Year(DateAdd("m", -3, CurrentDate)))) & '0' & (CStr(Month(DateAdd("m", -3, CurrentDate))))) To ((CStr(Year(DateAdd("m", -1, CurrentDate)))) & (CStr(Month(DateAdd("m", -1, CurrentDate)))))