Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Nov 2003
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with unbound combo boxes and subforms

    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.

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    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.
    Regards
    John



  3. #3
    Star Lounger
    Join Date
    Jan 2010
    Location
    Oregon
    Posts
    61
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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.<TabCtlName>.Pages(<PageIndexNumber>).Visible = True
    2) Refresh the proper subform, if necessary, with a Me.<SubformName>.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.

  4. #4
    Lounger
    Join Date
    Nov 2003
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Reid, yes that seems to be working thanks for your help.

    Best.

    Blitzy

Posting Permissions

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