Access TreeView reads the data table into a tree and links with the subform

Source: Internet
Author: User

Private Sub Form_Load ()
Dim I as Integer
Dim rst as DAO. Recordset
Set rst = Currentdb.openrecordset ("Select * from menu;") ' Set up a recordset as a table to be linked
If rst. RecordCount = 0 Then MsgBox "table has no data! The program terminates. ": Exit Sub" If the linked table has no data
i = 1
Rst. MoveFirst ' record first
While not rst. EOF ' cyclic recording
With Me.TreeView0.Nodes ' 1 records per loop add a category
. ADD, 4, "s" & I, "" & RST (1) & ""
End with
i = i + 1
Rst. MoveNext ' Next record
Wend
End Sub

Private Sub Treeview0_dblclick ()
Me.win.SourceObject = "Login"
End Sub

Access TreeView reads the data table into a tree and links with the subform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.