• Combo boxes (Access 2k)

    Author
    Topic
    #428261

    (Edited by HansV to make URL clickable – see Help 19)

    Greetings: I have a form with a subform. On the subform I have 2 combo boxes. The contents of combo one will determine the contents of the combo two. I can get this to work fine on a main form, but have difficulty doing the same task on the sub form. Any and all assistance is always greatly appreciated. I have looked at the post on http://www.mvps.org/access/forms/frm0031.htm%5B/url%5D but to no avail. TIA.

    Viewing 0 reply threads
    Author
    Replies
    • #994557

      One way to do this is as follows:

      Create a query that refers to the first combo box in its criteria, and use that as Row Source of the second combo box. The criteria will look like

      [Forms]![MainForm]![SubForm]![FirstComboBox]

      where MainForm is the name of the main form, SubForm is the name of the subform as a control on the main form (which is not necessarily the same as the name of the subform in the database window) and FirstComboBox is the name of the first combo box. You can find the name of the subform as a control by opening the main form in design view and clicking once on the subform. You’ll see the name in the toolbar and in the title bar of the Properties window.

      You must requery the second combo box in the After Update event of the first combo box:

      Private Sub FirstComboBox_AfterUpdate()
      Me.SecondComboBox.Requery
      End Sub

      • #994609

        Thank you Hans. As always, on the money.

        • #994772

          One more point. The ids of the combo boxes (column 0) are being stored in the tables. What needs to be done to store the description (column 1) in the tables? As always, thanks in advance.

          • #994775

            There is no point in storing the description in the tables if you have stored the ID. You can always look up the description using the ID, and if the description changes, your connection remains solid.

    Viewing 0 reply threads
    Reply To: Combo boxes (Access 2k)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: