konalion
03-21-2016, 11:41 AM
I continue to receive an ELSE without IF error for the below code. I'm sure it's some line break syntax issue, or maybe a complication of having the AND and THEN in the IF statement. Any guidance or suggestions are appreciated. I'm sure there are better ways to represent the entire code set, and I'm more than interested in those as well, but ultimately I just want the ELSE without IF error to stop. Thanks in advance for your assistance.
If r = ((DateSerial(collYears(s), collMonths(t), (1 + 7 * (collPosition(1))))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))) And _
((DateSerial(collYears(s), collMonths(t), (1 + 7 * (collPosition(1))))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))) > _
(DateSerial(collYears(s), (collMonths(t) + 1), 0)) Then _
collPrint.Add ((DateSerial(collYears(s), collMonths(t), (1 + 7 * (4)))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))), CStr _
(((DateSerial(collYears(s), collMonths(t), (1 + 7 * (4)))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))))
ElseIf r = ((DateSerial(collYears(s), collMonths(t), (1 + 7 * (collPosition(1))))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))) Then _
collPrint.Add r, CStr(r)
If r = ((DateSerial(collYears(s), collMonths(t), (1 + 7 * (collPosition(1))))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))) And _
((DateSerial(collYears(s), collMonths(t), (1 + 7 * (collPosition(1))))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))) > _
(DateSerial(collYears(s), (collMonths(t) + 1), 0)) Then _
collPrint.Add ((DateSerial(collYears(s), collMonths(t), (1 + 7 * (4)))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))), CStr _
(((DateSerial(collYears(s), collMonths(t), (1 + 7 * (4)))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))))
ElseIf r = ((DateSerial(collYears(s), collMonths(t), (1 + 7 * (collPosition(1))))) - _
(Weekday(DateSerial(collYears(s), collMonths(t), (8 - (collDY(1)))), vbSunday))) Then _
collPrint.Add r, CStr(r)