Question
November 19, 2007 at 01:05 PM
sidrajasekhar

SQL in VB 6

by sidrajasekhar . Updated 18 years, 11 months ago

Hi,

I am trying to input all the contents from a table into a VB flex grid which I am able to do. Then I want to create another loop just for one item in the flex grid. In this loop, the original data in the flex grid is a number. I want to take this number and check for its corresponding string value in another table. With the code below, I get the same string value from the second table for all the original numbers in the flexgrid.

Below is my code:

=====
intj = 1
Do Until rs.EOF = True ‘do until all records in recordset
DoEvents

inti = 0

Do Until inti = rs.Fields.Count ‘loop start
DoEvents

If Not IsNull(rs.Fields(inti)) Then
MSHFlexGrid1.Row = intj
MSHFlexGrid1.Col = inti
MSHFlexGrid1.TextMatrix(intj, 0) = rs.Fields(“CaseID”).Value
MSHFlexGrid1.TextMatrix(intj, 1) = rs.Fields(“UserID”).Value
MSHFlexGrid1.TextMatrix(intj, 2) = rs.Fields(“ApplicationID”).Value
MSHFlexGrid1.TextMatrix(intj, 3) = rs.Fields(“Problem”).Value
MSHFlexGrid1.TextMatrix(intj, 4) = rs.Fields(“Time_Working”).Value
MSHFlexGrid1.TextMatrix(intj, 5) = rs.Fields(“Time_Open”).Value
MSHFlexGrid1.TextMatrix(intj, 6) = rs.Fields(“QueueID”).Value
End If

inti = inti + 1
Loop ‘loop end

ApplicationID = MSHFlexGrid1.TextMatrix(intj, 2)

AppIDTemp = “select Application from tbl_Applications where ApplicationID = ApplicationID”
conn.Execute AppIDTemp
ApplicationName = rs1.Fields(“Application”).Value

MSHFlexGrid1.TextMatrix(intj, 2) = ApplicationName

MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1

intj = intj + 1

rs.MoveNext
Loop
=====

Thanks for your help.

This discussion is locked

All Comments