ow to print a tree view

Arcadium

New member
Local time
Today, 05:03
Joined
Nov 17, 2025
Messages
1
Ignorant newbie here needing help with calling a function. I'm trying to print an expanded tree view screen but keep getting various errors depending upon the structure of the call statement. Always fails on the "GetTreeViewText() line in the Sub. The latest version is as below. The form named "frm_treeview", the tree view object in the form is named "TreeReqs".What should be the correct syntax?

Private Sub PrntForm_Click()
GetTreeViewText (Me.Controls("TreeReqs")). <-- fails on this line
end subb

'GetTreeViewText (Forms("frm_Treeview").Controls("TreeReqs").Form) <-- another variation also fails


Function GetTreeViewText(treeView As treeView) As String
Dim treeText As String
Dim node As node
..
..
..
end function
 
Not sure what you are trying to do when you say "print an expanded tree view screen". Print what how - content of nodes to printer paper or PDF?

Not first time this has been asked https://www.access-programmers.co.uk/forums/threads/print-treeview-control.61400/

My Bing search returned AI response that basically paraphrases that thread.

If you want to provide db for analysis, follow instructions at bottom of my post.
 
Last edited:
No a lot there, is there? :(
You do not show the code in that function?
You also do not say what error(s) you get?

Help us to help you.
I know nothing about Treeviews. @MajP appears to be a treeview expert.

Hopefully he will chip in.

I am suprised that treeView is not TreeView, if it was recognised as an object?
 
maybe change the function to:
Code:
Function GetTreeViewText(tv As Object) As String
Dim treeText As String
Dim node As node
..
..
..
end function
 
Me.Controls("TreeReqs") is an Access.CustomControl object that only hosts the Treeview. Use its .Object property to expose the Treeview inside it, like...
Code:
Private Sub PrntForm_Click()
    GetTreeViewText Me.TreeReqs.Object
End Sub
 

Users who are viewing this thread

Back
Top Bottom