Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo boxes (Access 2k)

    (Edited by HansV to make URL clickable - see <!help=19>Help 19<!/help>)

    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 but to no avail. TIA.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo boxes (Access 2k)

    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

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo boxes (Access 2k)

    Thank you Hans. As always, on the money.

  4. #4
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Columbus, Ohio, USA
    Posts
    286
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Combo boxes (Access 2k)

    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.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Combo boxes (Access 2k)

    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.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •