Hi,
I am using the following code to fill a treeview but i am getting element not found do any one of you know why.(Error line# indicated by ***)
Dim strKey As String
Dim strCurr As String
Dim sSQL As String
Dim SQL As String
Dim CN As ADODB.Connection, RS As ADODB.Recordset
Set CN = CurrentProject.Connection
Set RS = New ADODB.Recordset
Me.axTreeView.Nodes.Clear
SQL = "SELECT DISTINCT [Curriculam Details].year,[Curriculam Details].[FacultyID#] FROM [Curriculam Details] WHERE ((([Curriculam Details].Year) Is Not Null) And (([Curriculam Details].[FacultyID#]) = " & Me.lstTest & ") ORDER BY [Curriculam Details].year;"
sSQL = "SELECT DISTINCT [Curriculam Details].[CurriculamID#], [Curriculam Details].[FacultyID#], [Individual Course Details].[Year], [Individual Course Details].[Term], [Degree council].[Course#], [Degree council].[Course_Title]"
sSQL = sSQL & " FROM ([Curriculam Details] INNER JOIN [Individual Course Details] ON [Curriculam Details].IndividualCourseID = [Individual Course Details].[CourseID#]) INNER JOIN [Degree council] ON [Individual Course Details].[DegreeCourseID#] = [Degree council].[DegreeCourseID#]"
sSQL = sSQL & " WHERE ((([Curriculam Details].[FacultyID#]) = " & Me.lstTest & " And (([Individual Course Details].Year) Is Not Null) And (([Individual Course Details].Term) Is Not Null)) ORDER BY [Individual Course Details].year;"
RS.Open SQL, CN, adOpenForwardOnly
Do Until RS.EOF
strKey = StrConv("o" & RS![Year], vbLowerCase)
Me!axTreeView.Nodes.Add , , strKey, RS!Year
RS.MoveNext
Loop
RS.close
RS.Open sSQL, CN, adOpenForwardOnly
Do Until RS.EOF
strKey = StrConv("p" & RS![CurriculamID#], vbLowerCase)
strCurr = StrConv(strKey & "o" & RS![Year], vbLowerCase)
Me!axTreeView.Nodes.Add strKey, tvwChild, strCurr, RS!Term '***
RS.MoveNext
Loop
RS.close
CN.close
Set CN = Nothing
Set RS = Nothing
Any help will be appreciated.
Thanks,
ran
I am using the following code to fill a treeview but i am getting element not found do any one of you know why.(Error line# indicated by ***)
Dim strKey As String
Dim strCurr As String
Dim sSQL As String
Dim SQL As String
Dim CN As ADODB.Connection, RS As ADODB.Recordset
Set CN = CurrentProject.Connection
Set RS = New ADODB.Recordset
Me.axTreeView.Nodes.Clear
SQL = "SELECT DISTINCT [Curriculam Details].year,[Curriculam Details].[FacultyID#] FROM [Curriculam Details] WHERE ((([Curriculam Details].Year) Is Not Null) And (([Curriculam Details].[FacultyID#]) = " & Me.lstTest & ") ORDER BY [Curriculam Details].year;"
sSQL = "SELECT DISTINCT [Curriculam Details].[CurriculamID#], [Curriculam Details].[FacultyID#], [Individual Course Details].[Year], [Individual Course Details].[Term], [Degree council].[Course#], [Degree council].[Course_Title]"
sSQL = sSQL & " FROM ([Curriculam Details] INNER JOIN [Individual Course Details] ON [Curriculam Details].IndividualCourseID = [Individual Course Details].[CourseID#]) INNER JOIN [Degree council] ON [Individual Course Details].[DegreeCourseID#] = [Degree council].[DegreeCourseID#]"
sSQL = sSQL & " WHERE ((([Curriculam Details].[FacultyID#]) = " & Me.lstTest & " And (([Individual Course Details].Year) Is Not Null) And (([Individual Course Details].Term) Is Not Null)) ORDER BY [Individual Course Details].year;"
RS.Open SQL, CN, adOpenForwardOnly
Do Until RS.EOF
strKey = StrConv("o" & RS![Year], vbLowerCase)
Me!axTreeView.Nodes.Add , , strKey, RS!Year
RS.MoveNext
Loop
RS.close
RS.Open sSQL, CN, adOpenForwardOnly
Do Until RS.EOF
strKey = StrConv("p" & RS![CurriculamID#], vbLowerCase)
strCurr = StrConv(strKey & "o" & RS![Year], vbLowerCase)
Me!axTreeView.Nodes.Add strKey, tvwChild, strCurr, RS!Term '***
RS.MoveNext
Loop
RS.close
CN.close
Set CN = Nothing
Set RS = Nothing
Any help will be appreciated.
Thanks,
ran