hi
i have a screen where most of the textboxes are been pulled and filled by database which i press my update button.

but im doing this new part to it where it looks for midrange values from the info in the datbase and what i want to it is when it runs to display the info in the text boxes not been populate by db
here is my code
Code:
Private Function MidRange()
On Error GoTo MidRange_Error
     
  Cmd$ = "SELECT MOODYSIRB,FITCHIRB ,SPIRB  " + CRLF$
  Cmd$ = Cmd$ + " FROM ACRT" + CRLF$
  Cmd$ = Cmd$ + " SAVE TO " + OPXCOM$ + "\MidRating.TXT DELIMITED;"

    '************** End of Custom Code Section - Select ************
    
    '*** Architecture call to get record from data base
    
    DBCALL "SELECT", "ACRT", Cmd$
     Dim sBuffer As String

    Dim fn As Integer
    Dim sbound As Boolean
Dim TempArray As Variant
    fn = FreeFile
 
 
    Open OPXCOM$ + "\MidRating.TXT" For Input As #fn
   

    Do While Not EOF(fn)
 Line Input #fn, sBuffer
      '    Input #fn, sBuffer



TempArray = Split(sBuffer, ",") ' this will split the data on each comma
' convert your text data into integers for the subroutine
MidLevelPostNotched (TempArray(0)), (TempArray(1)), (TempArray(2))
             

    sRatingAgency = (Text2(0).Text)
    iMidLevelPostNotched = (Text2(2).Text)
     

   
    Loop
   
   
    result = 0
   
MidRange_Exit:
    Exit Function
MidRange_Error:
    ErrorRoutine$ = "MidRange"
    Gerr Err
End Function
Code:
Public Sub MidLevelPostNotched(iMoodys As Integer, iSP As Integer, iFitch As Integer)

    Dim iHighest As Integer
    Dim iArr As Variant

    If iMoodys = 0 Or iSP = 0 Or iFitch = 0 Then
        'get highest value
        iHighest = iMoodys
        sRatingAgency = MOODYS_TITLE

        If iSP > iHighest Then
            iHighest = iSP
            sRatingAgency = SP_TITLE
        End If
        If iFitch > iHighest Then
            iHighest = iFitch
            sRatingAgency = FITCH_TITLE
        End If
       iMidLevelPostNotched = iHighest
    Else
        'get median value - Sort the array and get the mid value
        iArr = Array(0, iMoodys, iSP, iFitch)
        ' Sort the Array and display the values in order.
        BubbleSort iArr
        iMidLevelPostNotched = iArr(2)
        
        If iMidLevelPostNotched = iMoodys Then
            sRatingAgency = MOODYS_TITLE
        ElseIf iMidLevelPostNotched = iSP Then
            sRatingAgency = SP_TITLE
        ElseIf iMidLevelPostNotched = iFitch Then
            sRatingAgency = FITCH_TITLE
        End If
        
        
        
    End If


End Sub
and ideas how i can do this from about code was trying it like this but doesnt work
Code:
sRatingAgency = (Text2(0).Text)
    iMidLevelPostNotched = (Text2(2).Text)