getting text to display in textbox
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)
Re: getting text to display in textbox
hi
i still need to display text in a text box but just in a different way this time
this is my code
Code:
Cmd$ = "Select OPICSCNO,CNO" + CRLF$
Cmd$ = Cmd$ + "from CCRT,ACRT" + CRLF$
Cmd$ = Cmd$ + " Where CCRT.OPICSCNO = ACRT.CNO " + CRLF$
Cmd$ = Cmd$ + " SET CCRT.OPICSCNO = text1(10) " + CRLF$
getting error at Cmd$ = Cmd$ + " SET CCRT.OPICSCNO = text1(10) " + CRLF$
is my code right
Re: getting text to display in textbox
Do not use "+" symbol as it is for addition use "&" symbol as this one is for "and"
Re: getting text to display in textbox
No
You are trying to do an update in a select statement
You are trying to set what appears to be a numeric field to the literal text "text1(10)" which would crash if it were a proper update statement.
Also you say you need to display something but the code you have shown is not for display so I'm not sure what you are even trying to do.