Private Function WriteShow(pShow As String)
Debug.Print "Writing Show"
On Error GoTo Error
If Selection = Show_Name Then
'TreeView.SelectedItem.Next
'TreeView.SelectedItem.Next
'TreeView.SelectedItem.Next
Selection = Show_Name & ".Rundown"
End If
FlexGridDone = False
Dim Counter As Integer
Dim Counter2 As Integer 'For Refresing of FlexGrid
Dim Total As Integer
'Remove All Items Cept The First Top Item!
Counter2 = 2
Total = MSFlexGrid1.Rows
'Remove all items?
If Total >= 1 Then
Do Until Counter2 = MSFlexGrid1.Rows
MSFlexGrid1.RemoveItem (Counter2)
Counter2 = Counter2 + 1
Loop
End If
'Act Normal
cn.Open
SQL = "SELECT * FROM `Rundown` WHERE `Show` = '" & Show_Name & "' ORDER BY `Pos` ASC"
rs.Open SQL, cn, adOpenForwardOnly, adLockOptimistic
Counter2 = 0
'MSFlexGrid1.RemoveItem
Counter = 1
With rs
Do Until rs.EOF = True
MSFlexGrid1.AddItem ("")
'Fill In the Col. Data.
MSFlexGrid1.TextMatrix(Counter, 2) = !Tal
MSFlexGrid1.TextMatrix(Counter, 3) = !Slug
MSFlexGrid1.TextMatrix(Counter, 4) = !Format
MSFlexGrid1.TextMatrix(Counter, 5) = !Graphics
MSFlexGrid1.TextMatrix(Counter, 6) = !Status
MSFlexGrid1.TextMatrix(Counter, 7) = !Tape
MSFlexGrid1.TextMatrix(Counter, 8) = !SOT
MSFlexGrid1.TextMatrix(Counter, 9) = !Read
MSFlexGrid1.TextMatrix(Counter, 13) = !autonumber
'.TextMatrix(Counter, 2) =
'Go To New Row
'Fill First Col With Data
Counter = Counter + 1
.MoveNext
Loop
End With
Dim Total_Results As Integer
Total_Results = Counter - 1
rs.Close
cn.Close
'Fix for wierd cell bug
MSFlexGrid1.Row = 1
MSFlexGrid1.Col = 1
MSFlexGrid1.CellBackColor = RGB(255, 255, 255)
'Possibly Fix another bad FlexGrid Bug?
If MSFlexGrid1.Rows >= Total_Results Then
MSFlexGrid1.RemoveItem (MSFlexGrid1.Rows)
End If
If Not MSFlexGrid1.Rows = Total_Results Then
WriteShow (Show_Name)
MSFlexGrid1.Redraw = True
MSFlexGrid1.Refresh
End If
'Fix another flexgrid bug we've developed!
'Remove all rows w/o Identifer
'Dim Counter3 As Integer
'Counter3 = 2
'Do Until Counter3 = MSFlexGrid1.Cols
' If MSFlexGrid1.TextMatrix(Counter3, 13) = "" Then
'' MSFlexGrid1.RemoveItem (MSFlexGrid1.Row)
' End If
' ' Counter3 = Counter3 + 1
'Loop
FlexGridDone = True
FillGrid = True
MSFlexGrid1.Redraw = True
MSFlexGrid1.Refresh
Error:
If Err.Number = 30002 Then
MSFlexGrid1.Redraw = True
MSFlexGrid1.Refresh
FlexGridDone = True
FillGrid = True
End If
MSFlexGrid1.Redraw = True
MSFlexGrid1.Refresh
FlexGridDone = True
FillGrid = True
'Debug.Print "Another FlexGrid Error " & Err.Number & " " & Err.Description
End Function