Click to See Complete Forum and Search --> : Flexgrid traversal


Ghost308
June 18th, 2001, 08:28 AM
I'm trying to traverse a flexgrid to store a value from one columb into a particular array based on the date value of another column. The date value is compared with the Monthview1.Selstart and MonthView1.Selend. I can do a simple comparison like this...

if frmTools!Flex1.TextMatrix(1,4) < MonthView1.Selstart Then Beep

...and it runs just fine. But when i substitute the row value in TextMatrix with a value from a loop, the returned value is a mismatched type. I am really confused and have put in an hours time just fiddling with this line of code. Makes no sense to me. Here is the code i've written, the errors come in the first "If...Then" lines. Thanks already for any help, everyone!

Dim i As Integer
For i = 1 To frmTools!Flex1.Rows - 1
If frmTools!Flex1.TextMatrix(i, 4) > MonthView1.SelStart Then

If frmTools!Flex1.TextMatrix(i, 4) < MonthView1.SelEnd Then

Select Case frmTools!Flex1.TextMatrix(i, 1)
Case "Bellevue"
Bellevue(senBel) = frmTools!Flex1.TextMatrix(i, 3)
senBel = senBel + 1
Case "Brooks"
Brooks(senBro) = frmTools!Flex1.TextMatrix(i, 3)
senBro = senBro + 1
Case "Democrat"
Democrat(senDem) = frmTools!Flex1.TextMatrix(i, 3)
senDem = senDem + 1
Case "Midtown"
Midtown(senMid) = frmTools!Flex1.TextMatrix(i, 3)
senMid = senMid + 1
Case "Scott"
Scott(senSco) = frmTools!Flex1.TextMatrix(i, 3)
senSco = senSco + 1
End Select

End If

End If

Next i

TH1
June 18th, 2001, 08:40 AM
Change your declaration of i to long instead of integer as this is what Textmatrix uses