• Help with unbound combo boxes and subforms

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Help with unbound combo boxes and subforms

    Author
    Topic
    #478558

    Hi, I have a form on which I have placed a couple of unbound combo boxes, one relates to Tables and the others to fields, and the subforms give a more detailed breakdown of each (table or field). How do I get the subform to automatically show the table selected in the Table combo box and the field in the field combo box??

    e.g. I have a table called “Client” with an Id of 1, which can be selected in the dropdown Combo box called Combo_Client which shows only its name (Id number is there in bound column 1 but not visible). If I select it, I wish my subform, Child_Table, to then show the fuller details of the table which is incorporated in the form Fm_Tables, and so on with the fields.

    I’ve been trying to code the after update event of the combo boxes, but coding isn’t my strong point. Can you help?

    Blitzy.

    Viewing 1 reply thread
    Author
    Replies
    • #1294533

      Can you post what you have been working with?

      When you say that you ” have a table called ‘Client’ with an Id of 1″ what does it mean for a table to have an ID? I am used to records within a table having an ID, but not tables themselves.

    • #1295105

      I’m a tad confused here, too, but have an idea. It sounds like you have one subform for your Tables combo box, and another subform for your Fields combo box. I’m assuming each subform contains different fields, so they aren’t generic between the two combo boxes. Assuming I’m correct so far, here’s what I’ve done in the past:

      First, add a Tab Control to your main form and create two pages, one for each subform. Add a subform to each page and supply the linking field information (child and master), just like you would for bound controls. For the child link in the subform, you can link to an unbound control by literal reference: Forms![FormsName]![ControlName]. Now the two subforms are looking to their respective unbound combo boxes for the matching ID value. So far, so good.

      Next, on the AfterUpdate event of each combo box, do the following:
      1) Set the Visible property of one Tab Control Page to False, and the other to True like this: Me..Pages().Visible = True
      2) Refresh the proper subform, if necessary, with a Me..Requery

      I think that should do it. Now only one subform is visible and showing the detail of the corresponding combo box selection. Hope this helps.

      • #1295176

        Hi Reid, yes that seems to be working thanks for your help.

        Best.

        Blitzy

    Viewing 1 reply thread
    Reply To: Help with unbound combo boxes and subforms

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

    Your information: