How does Access solve the combo box Can't meet the choice of data?

zhaozj2021-02-16  49

How to solve the combo box unable to meet the problem of large amounts of data?

problem:

There is a combo box in Access, which can quickly select the required data from multiplexes. But if you record more than 1000-2000? It is very inconvenient to choose. what do I do?

Reply:

In fact, many data can be classified (layered) to select, and we can pre-screen data. The following example is to use repeatedly open the same form class to complete the selection of multi-level data. Of course, it also includes pre-screening data functions. Please refer to the reference: "Novice: How to design the table structure facilitates TreeView display? "Http://access911.net/index.asp?board=4&recordid=75fabe1e12dc) For details, how to define the data table structure can be easily classified and displayed. And read: "How to turn a form to open 2 times, and the form opened in each other displays different data? "Http://access911.net/index.asp?board=4&recordid=72fab11e15dc one text, to understand an form in Access is actually a class, now start: 1, create a form (Testform), there is a text Box (Text0), a button (Command2). 2. Create a form (SELECTFORM) with a list box (LIST0). 3. Write the following code in the "Update" event of the text box in TestForm to open the product name to select the form (SELECTFORM) and assign the row source of the list box (LIST0).

Private sub text0_afterupdate () DOCMD.OPENFORM "SelectForm" 'This line code implements the fuzzy retrieval of the BType table, using the LIKE keyword in the WHERE clause for wild form ("selectform"). List0.rowsource = " Select btype.soncount, btype.usercode, btype.fullname, btype.typeid from btype where btype.Fullname Like '* "& text0.value &" *' "End Sub4," click "event in the command button in TestForm Write the following code to open the product name to select the form, and retrieve 5 according to the classification, then enter the following code in the TestForm to complete the function of opening the form itself and displays the data in the subclass. In order to be able to use the code repeatedly, two general processes have been written

Option Compare DatabaseDim F Private Sub Form_KeyDown (Keycode As Integer, Shift As Integer "The" Key Preview "property set first is" Yes "'This process will speed up your input speed' If you press Escape keys, close the window body If KeyCode = vbKeyEscape Then closeAllSelectForm "SelectForm" End IfEnd Sub Private Sub List0_DblClick (Cancel As Integer) checkYouSelectEnd Sub Private Sub List0_KeyPress (KeyAscii As Integer) 'according to the present process to achieve full keyboard If KeyAscii = 13 Then checkYouSelect End IfEnd Sub Sub closeAllSelectForm ( strFormName As String) 'general process 1' of the present process is used to close all the specified name form for Each objForm in Forms If objForm.Name = strFormName Then DoCmd.Close acForm, objForm.Name End If Next objFormEnd Sub Sub checkYouSelect () 'General Procedure 2' Detecting your choice 'If the SUNCOUNT is listed as 0 (indicating that there is no next layer)', you can put your selected product name in the text box in Error Resume next set f = new form_selectform Dim Objform as form if list0.column (0) = 0 THEN FORMS ("testform"). Text0.Value = List0.column (2) CloseallSelectForm "selectform" else f.visible = True f.list0.rowsource = "select btype.soncount, btype.usercode, btype.fullname, btype.typeid from btype where parid = '" & list0.value & "'" End IFEND SUB Details Example Program For details: http: //www.access911.net/index.asp?board=8&recordid=77fab71ehttp://access911.net webmaster collection

转载请注明原文地址:https://www.9cbs.com/read-24497.html

New Post(0)