Empty Recordset [Resolved]
I added a record to the table and I am still getting empty recordset. I have two tables:
tblClassification - id, classification
tblSnipplets - id, dateadded, classification, code, title
I am getting the following error:
Run-Time Error '3021'. Either BOF or EOF is True, or the current record has been deleted.
Code:
Private Sub initializeTree()
tvwItems.ImageList = imgList
Dim nodClass As Node
Dim nodTitle As Node
tvwItems.LineStyle = tvwRootLines
tvwItems.Nodes.Clear
'Opens the recordset for Class
Set rsClass = New ADODB.Recordset
strSQLClass = "SELECT id, classification FROM tblClassification ORDER BY classification"
rsClass.Open strSQLClass, conTree, adOpenStatic, adLockOptimistic
'set node for treeview
If rsClass.RecordCount > 0 Then
While Not rsClass.EOF
Set nodClass = tvwItems.Nodes.Add(, , (rsClass.Fields("classification")), (rsClass.Fields("classification")), 1)
rsClass.MoveNext
DoEvents
Wend
End If
'Opens the recordset for Title
Set rsTitle = New ADODB.Recordset
strSQLTitle = "SELECT title, classification, code, dateadded FROM tblSnipplets WHERE classification LIKE '" & (rsClass.Fields("classification")) & "%'"
rsTitle.Open strSQLTitle, conTree, adOpenStatic, adLockOptimistic
'set node for treeview
If rsTitle.RecordCount > 0 Then
While Not rsTitle.EOF
Set nodTitle = tvwItems.Nodes.Add((rsClass.Fields("classification")), tvwChild, (rsTitle.Fields("title")), (rsTitle.Fields("title")), 2)
rsTitle.MoveNext
DoEvents
Wend
End If
End Sub