An old and until now reliable function has suddenly started to return an error "invalid procedure name or argument"
Public Function nextdemand(per, dat) As Date
Dim FirstDate As Date ' Declare variables.
Dim IntervalType As String
Dim Numbr As Integer
Dim msg As String
Numbr = 1
If per = "2" Then
Numbr = 2
End If
If per = "4" Then
Number = 4
End If
If per = "M" Then
IntervalType = "m"
End If
If per = "W" Or per = "2" Or per = "4" Then
IntervalType = "ww"
End If
If per = "Q" Then
IntervalType = "q"
End If
'MsgBox (IntervalType)
nextdemand = DateAdd(IntervalType, Numbr, dat)
End Function
BUT if the msgbox command (which went in in debugging) is activated all works perfectly - but there is the irritation of a pop up box which I dont want or need - what am I doing wrong? All help greatly appreciated.
Public Function nextdemand(per, dat) As Date
Dim FirstDate As Date ' Declare variables.
Dim IntervalType As String
Dim Numbr As Integer
Dim msg As String
Numbr = 1
If per = "2" Then
Numbr = 2
End If
If per = "4" Then
Number = 4
End If
If per = "M" Then
IntervalType = "m"
End If
If per = "W" Or per = "2" Or per = "4" Then
IntervalType = "ww"
End If
If per = "Q" Then
IntervalType = "q"
End If
'MsgBox (IntervalType)
nextdemand = DateAdd(IntervalType, Numbr, dat)
End Function
BUT if the msgbox command (which went in in debugging) is activated all works perfectly - but there is the irritation of a pop up box which I dont want or need - what am I doing wrong? All help greatly appreciated.