Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Problem with Treeview code
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Guest, post: 10691834"] Hi Kev, You can try this Private Sub Form_Load() On Error GoTo ErrForm_Load Dim db As Database Dim rst As Recordset Dim nodCurrent As Node, nodRoot As Node Dim objTree As TreeView Dim strText As String, bk As String Dim tmp_str as string Set db = CurrentDb Set rst = db.OpenRecordset("Employees", dbOpenDynaset, dbReadOnly) Set objTree = Me!xTree.Object rst.FindFirst "[ReportsTo] Is Null" Do Until rst.NoMatch strText = rst![LastName] & (", " + rst![FirstName]) I dunno why add method doesn't accept string composed in the call. You have to pass a variable that contains the comèposed string. tmp_str="a" & rst!EmployeeID Set nodCurrent = objTree.Nodes.Add(, , tmp_str, strText) bk = rst.Bookmark AddChildren nodCurrent, rst rst.Bookmark = bk rst.FindNext "[ReportsTo] Is Null" Loop ExitForm_Load: Exit Sub ErrForm_Load: MsgBox Err.Description, vbCritical, "Form_Load" Resume ExitForm_Load End Sub [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft Access
Microsoft Access VBA Modules
Problem with Treeview code
Top