TheLaughingMan
Programmer
Hi, iv put some code into a project im working on, the code is for a flex grid.
all code seems fine and compiles okay, but i keep getting a runtime error when i click the flexgrid.
Run-time Error '91'
Object variable or With block variable not set.
Heres the code
[VB]
Private Sub GetBundles(ProductCode)
Dim Cols As Integer
Dim Rows As Integer
Dim cnn As Connection
Dim Columns
Dim CurrentColHead As Integer
Dim InsertCtrlPoints(10)
Dim Bundles As Recordset
Set cnn = CurrentProject.AccessConnection
Cols = 2
With grdWIPBundles
.Clear
.Cols = Cols
.Row = 2
.FixedRows = 1
.FixedCols = 1
.ColWidth(0) = 155
.RowHeight(0) = 300
.FocusRect = flexFocusHeavy
.SelectionMode = flexSelectionFree
.Row = 0
col_ix = 1
.TextArray(col_ix) = "Bundle No."
.ColWidth(col_ix) = 2000
.ColAlignment(col_ix) = flexAlignLeftCenter
Bundles.Open "SELECT * FROM Vw_Tk_Bundles" 'Debug here
While Not Bundles.EOF
.AddItem vbTab & Bundles!BundleNum
Bundles.MoveNext
Wend
Bundles.Close
.RowHeight(1) = 0
End With
cnn.Close
End Sub
[/VB]
If anyone has any ideas please let me know!
Thanks
all code seems fine and compiles okay, but i keep getting a runtime error when i click the flexgrid.
Run-time Error '91'
Object variable or With block variable not set.
Heres the code
[VB]
Private Sub GetBundles(ProductCode)
Dim Cols As Integer
Dim Rows As Integer
Dim cnn As Connection
Dim Columns
Dim CurrentColHead As Integer
Dim InsertCtrlPoints(10)
Dim Bundles As Recordset
Set cnn = CurrentProject.AccessConnection
Cols = 2
With grdWIPBundles
.Clear
.Cols = Cols
.Row = 2
.FixedRows = 1
.FixedCols = 1
.ColWidth(0) = 155
.RowHeight(0) = 300
.FocusRect = flexFocusHeavy
.SelectionMode = flexSelectionFree
.Row = 0
col_ix = 1
.TextArray(col_ix) = "Bundle No."
.ColWidth(col_ix) = 2000
.ColAlignment(col_ix) = flexAlignLeftCenter
Bundles.Open "SELECT * FROM Vw_Tk_Bundles" 'Debug here
While Not Bundles.EOF
.AddItem vbTab & Bundles!BundleNum
Bundles.MoveNext
Wend
Bundles.Close
.RowHeight(1) = 0
End With
cnn.Close
End Sub
[/VB]
If anyone has any ideas please let me know!
Thanks