473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

runtime error 3265

nurikoAnna
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. Dim rsFaculty As New ADODB.Recordset
  4. Dim rsDepartment As New ADODB.Recordset
  5. Dim oCm As New ADODB.Command
  6.  
  7. Private Sub Disconnect()
  8.    connect.Close
  9. End Sub
  10.  
  11.  
  12.  
  13. Private Sub Form_Load()
  14.  
  15. 'connect.Execute ("SELECT `t_faculty`.`FacultyFName`,`t_faculty`.`FacultyMI`,`t_faculty`.`FacultyLName`,`t_faculty`.`DepartmentID`,`t_department`.`Department`FROM `t_faculty`INNER JOIN `t_department` ON (`t_department`.`DepartmentID` = `t_faculty`.`DepartmentID`)")
  16. 'Call connect
  17. 'SQLconnection
  18. Call fillTree
  19.  
  20.  
  21.  
  22.  
  23. End Sub
  24.  
  25.  
  26. Sub fillTree()
  27.  
  28. Dim sqlFaculty As String
  29. Dim sqlDepartment As String
  30. Dim nodeDepartment As Node
  31. Dim nodeFaculty As Node
  32.  
  33.  
  34. sqlDepartment = "SELECT `t_department`.`DepartmentID`FROM `t_department`"
  35. sqlFaculty = "SELECT `t_department`.`Department`,`t_faculty`.`FacultyFName`,`t_faculty`.`DepartmentID`FROM `t_faculty`INNER JOIN `t_department` ON (`t_department`.`DepartmentID` = `t_faculty`.`DepartmentID`)"
  36.  
  37. tvTreeView.Nodes.Clear
  38. SQLconnection
  39. rsDepartment.Open sqlDepartment, connect, adOpenDynamic, adLockOptimistic
  40.  
  41.     Dim i As Integer, j As Integer
  42.     With rsDepartment
  43.  
  44.         While Not .EOF
  45.                Set nodeDepartment = tvTreeView.Nodes.Add(, , ![Department], ![Department], 1)
  46.             nodeDepartment.Expanded = True
  47.  
  48.              Set rsFaculty = oCm.Execute(, Array(![DepartmentID]))
  49.                 While Not rsFaculty.EOF
  50.                 Set nodeFaculty = tvTreeView.Nodes.Add(nodeDepartment.Index, tvwChild, , rsFaculty![FacultyFName], 1, 1)
  51.                     j = j + 1
  52.                     rsFaculty.MoveNext
  53.                 Wend
  54.                 nodeDepartment.Text = nodeDepartment.Text & "  [" & Trim(Str(j)) & "]"
  55.                 j = 0
  56.             i = i + 1
  57.             .MoveNext
  58.         Wend
  59.     End With
  60.     Disconnect
  61. End Sub 
  62.  
  63.  
  64.  
above are my codes for to populate data in a list view...call data from the database..

Currenty i am using MySQL as a database....


I have a table t_department and another table is t_faculty...What I like to do using a treeview....I want to display in the treeview the parent node as Department name then the child nodes are list of the Faculty names...

and i always got an error :

runtime error 3265

item cannot be found in the collection corresponding to the requested name or cardinal at the underlined line above...

please help.......
Jan 13 '09 #1
2 3009
debasisdas
8,127 Expert 4TB
Have you opend the ADODB connection object ?
I can't find that in your code.
Jan 14 '09 #2
MikeTheBike
639 Expert 512MB
Hi

From you post it is this line producing the error

Set nodeDepartment = tvTreeView.Nodes.Add(, , ![Department], ![Department], 1)

and the error suggests that [Department] field is not included in the recordset.

From the SQl statment ie.
sqlDepartment = "SELECT `t_department`.`DepartmentID`FROM `t_department`"

it would seem that that is indeed the case ([DepartmentID] is not [Department]) ???

MTB
Jan 14 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sivasenthil | last post by:
With the Runtime error above , I get the following message" Item cannot be found in the collection corresponding to the requested name or ordinal" Is this application specific or a common VB...
0
by: rajkalacbe | last post by:
I am running a visual basic executable program through Forms4.5 of D2K using Forms menu options.. When I Invoke this form in the server where I have the database installed, I do not have any...
6
by: darkhat01 | last post by:
I am getting a Run-Time error '3265': Item cannot be found in the collection corresponding to the requested name or ordinal. The Function call I am using is: ...
2
by: rando1000 | last post by:
I'm not sure why I'm getting this error. When I look at my locals window, I can see item "rs", which has fields Container and Expr1001. Here's the code: Private Sub Command8_Click() Dim...
1
by: wassimdaccache | last post by:
Hello Please help me I working on database using access 2003 I'm writing into a save bottom on a form this code to insert some of my value on another table ...no relationship between them ...
1
by: thejad | last post by:
Hi, I looked up all I could read up on the error, and still can't make heads or tails of what I am doing wrong. My goal is to be able to update a series of fields for a specific record using...
2
by: marcohod | last post by:
Hi, I'm using ADO 2.8 in VB6 to use an SQL Server 2000 database. This works: Dim MyRS2 As New ADODB.Recordset MySQL = "Select * from table1" MyRS2.Open MySQL, sqlConnection,...
3
by: DGNinja12 | last post by:
I get this error when i run, i cant figure out what is wrong Can some one please help me? Run-time error '3265': Item cannot be found in the collection corresponding to the requested name or...
0
nurikoAnna
by: nurikoAnna | last post by:
Dim rsFaculty As New ADODB.Recordset Dim rsDepartment As New ADODB.Recordset Dim oCm As New ADODB.Command Private Sub Disconnect() connect.Close End Sub
8
by: charli | last post by:
Error 3265, "Item cannot be found in the collection corresponding to the requested name or ordinal" code programatically opens a query using ADOX and changed the sql Dim cat As New...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.