Another fine gem mined from the codebase
-
Private Function SomeCrappyCode(lsDate As String) As Long On Error GoTo ErrorHandler Dim llRetval Dim llPosition As Long 'Updates the US Month Name in SQL Date to Locale 'Month Name in Locale Language llPosition = InStr(lsDate, "Jan") If llPosition > 0 Then lsDate = Left(lsDate, llPosition - 1) & Format(DateSerial(98, 1, 1), "MMM") & right(lsDate, Len(lsDate) - 3) llRetval = True Exit Function End If 'Copy & paste the above code block 11 more times for Feb...December mlUpdateMonthStringLocale = llRetval Exit Function ErrorHandler: WriteErrorLogEntry Err.number, "SomeCrappyCode", Err.description Exit Function Resume End Function
-
Private Function SomeCrappyCode(lsDate As String) As Long On Error GoTo ErrorHandler Dim llRetval Dim llPosition As Long 'Updates the US Month Name in SQL Date to Locale 'Month Name in Locale Language llPosition = InStr(lsDate, "Jan") If llPosition > 0 Then lsDate = Left(lsDate, llPosition - 1) & Format(DateSerial(98, 1, 1), "MMM") & right(lsDate, Len(lsDate) - 3) llRetval = True Exit Function End If 'Copy & paste the above code block 11 more times for Feb...December mlUpdateMonthStringLocale = llRetval Exit Function ErrorHandler: WriteErrorLogEntry Err.number, "SomeCrappyCode", Err.description Exit Function Resume End Function
-
Private Function SomeCrappyCode(lsDate As String) As Long On Error GoTo ErrorHandler Dim llRetval Dim llPosition As Long 'Updates the US Month Name in SQL Date to Locale 'Month Name in Locale Language llPosition = InStr(lsDate, "Jan") If llPosition > 0 Then lsDate = Left(lsDate, llPosition - 1) & Format(DateSerial(98, 1, 1), "MMM") & right(lsDate, Len(lsDate) - 3) llRetval = True Exit Function End If 'Copy & paste the above code block 11 more times for Feb...December mlUpdateMonthStringLocale = llRetval Exit Function ErrorHandler: WriteErrorLogEntry Err.number, "SomeCrappyCode", Err.description Exit Function Resume End Function
-
I am not sure how it works in VB exactly, but in a normal language this code would alter local variables
lsDate
andllRetval
without affecting the outside world. So, this function does virtually nothing. Am I right?Greetings - Jacek
in this case, the incoming parameter defaults to "ByRef", lRetVal defaults to Variant, and the return value is only set when the line of code "ThisFunctionName = aValue", so luckily it sets the lsDate param, but the return value is never set 'cause the author was retarded
-
in this case, the incoming parameter defaults to "ByRef", lRetVal defaults to Variant, and the return value is only set when the line of code "ThisFunctionName = aValue", so luckily it sets the lsDate param, but the return value is never set 'cause the author was retarded