DeeDee said:
If PayCycle = Weekly Then
Return PaymentDate + 7
ElseIf PayCycle = Bi - Weekly Then
Return PaymentDate + 14
ElseIf PayCycle = Monthly Then
Return PaymentDate + 30
End If
End Sub
Is this code in a function? If so, you need to assign the return value
to the name of the function, as well as changing your code in other
ways. There is no "Return" statement in VBA.
You *could* have a function something like this:
'----- start of example code -----
Function NextPaymentDate( _
PaymentDate As Date, _
PayCycle As String) _
As Date
Select Case PayCycle
Case "Weekly"
NextPaymentDate = PaymentDate + 7
Case "Bi - Weekly"
NextPaymentDate = PaymentDate + 14
Case "Monthly"
NextPaymentDate = DateAdd("m", 1, PaymentDate)
Case Else
Err.Raise 5 ' bad value for PayCycle
End Select
End Function
'----- end of example code -----
But you haven't told us anything about where your code was placed, or
how it is to be called, so all this is just speculation.