Parameter Problem

K

Kro

I want to change the value in a txt box (or combo box) & then after update,
populate a tree list control based on the value. It gets hung up when the
rstCategory opens using the SQL. Here is the code:

Public Sub PopulateTree()

Dim rstCategory As New ADODB.recordset, rstComponent As New ADODB.recordset
Dim rstSubComponent As New ADODB.recordset
Dim tvwTree As Object
Dim nodX As Node
Dim I As Integer
Dim blnAllRecs As Boolean
Dim SQL As String


Set tvwTree = Me.tvwItems

'Renumber all items
RenumberItems

'Clear out all current items
tvwTree.Nodes.Clear

'Set blnAllRecs to use in query building
If Me.fmeView = 1 Then
blnAllRecs = False
Else
blnAllRecs = True
End If


'Build recordset for Categories (from a pre-selected client) at top level
SQL = "SELECT Categories.catID, Categories .catName " & _
"FROM Categories" & _
"WHERE Categories.pID = " & [Forms]![frmComponents]!txtpID.Value & _
"ORDER BY Categories.catName"

rstCategory.Open SQL, CurrentProject.Connection, adOpenStatic,
adLockReadOnly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top