Using the ByRef param in a function - MAX POINTS
Posted on 2006-11-13
I am performing maintence on an application. I would like to avoid having to write another function that is performing a similar task, and really change as little code as possible (this is one of those "held together in it's own chaos" type of applications).
What i need to do it use the paygrade parameter after calling the function.
How can i do this?
When the function is being called an empty string is being passing as the paygrade, and you can see where paygrade is getting set at the forth line from the bottom of the function.
I think this should be a quick/easy answer. I just can't think of the syntax to use that parameter.
I need to do analysis on the paygrade after calling the function without changing the return value that is being set (0, 965, 964, etc)
Public Function getGradeRate(ByVal grade As String, ByRef paygrade As String) As Long
', ByVal isOfficer As Boolean
If Not doInitializeDB2 Then
'error in Class_Initialize
getGradeRate = 99
Dim rate As String
rate = grade
Dim cmdParams(1) As Parameter
Set cmdParams(0) = createInputParameter("gradeRate", adChar, 5)
cmdParams(0) = UCase(rate)
Dim oRsGradeRate As ADODB.Recordset
Set oRsGradeRate = oDatabase.getData("sGradeRate", cmdParams) 'select_grade_rate
If oRsGradeRate Is Nothing Then
'failed to retrieve the RS
sErrorMessage = "Failed to retrieve grade rate." & vbCrLf & oDatabase.dbError.Description
getGradeRate = 964
If oRsGradeRate.EOF Then
'failed to find grade rate
sErrorMessage = "Unable to find grade rate in the TRDB."
getGradeRate = 965
'destroy command parameter objects created
Dim i As Integer
For i = UBound(cmdParams) To LBound(cmdParams) Step -1
Set cmdParams(i) = Nothing
paygrade = oRsGradeRate("grade_description")
Set oRsGradeRate = Nothing
getGradeRate = 0
End Function 'getGradeRate