Access resolution combo box does not meet a large number of data selection problems

Source: Internet
Author: User

Problem:

Access has a combo box that allows you to quickly select the data you want from the Multiline records. But what if the record is over 1000-2000? The choice is very inconvenient. What am I going to do?

Reply:

In fact, a lot of data can be sorted (layered) to select, and we can filter the data beforehand.

The following example is the choice of multi-level data by opening the same form class repeatedly.

Of course, the pre-filtered data feature is also included.

Before reading this article, please refer to:

Novice: How to design a table structure for the TreeView display? 》

Http://access911.net/index.asp?board=4&recordid=75FABE1E12DC

Article to learn how to define a data table structure that can be easily categorized and displayed.

and read:

How do I open a form 2 times, and each time the open form displays different data? 》

Http://access911.net/index.asp?board=4&recordid=72FAB11E15DC

Article to learn that a form in access is actually a class

Okay, here we go:

1, create a form (Testform), which has a text box (TEXT0), a button (Command2).

2, create a form (Selectform), which has a list box (LIST0).

3. Write the following code in the "updated" event of the text box in Testform to open the name selection form (selectform) and assign the row source (RowSource) of the list box (LIST0).

Private Sub Text0_AfterUpdate()
DoCmd.OpenForm "selectform"
'这行代码就实现了BTYPE表的模糊检索,使用的是 WHERE 子句中的 LIKE 关键字进行通配
Forms("selectform").List0.RowSource = "SELECT btype.soncount, btype.UserCode, btype.FullName, btype.typeId FROM btype WHERE btype.fullname like '*" & Text0.Value & "*' "
End Sub

4. Write the following code in the "click" Event of the command button in Testform to open the name selection form and search by category

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.