Run-time error '2147217900 (80040e14)

K

Kro

I have a tree list control I want to populate with Categories based on a
Client. The client number is input into a text box & then the update event
populates the tree based on the selection. I get a syntax error when it
tries to open the recordset based on the SQL. Two tables are invloved
(Client & Categories; in a 1-to-many relationship on pID field). Here'e the
code:

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.pID, Categories.catID, Categories.catName " & _
"FROM Categories " & _
"WHERE Categories.pID = " & Forms!frmComponents!txtpID & _
"ORDER BY Categories.catName"

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


Any suggestions?
 

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

Top