Results 1 to 4 of 4

Thread: Form Help

  1. #1
    Join Date
    Jun 2009
    Posts
    95

    Unanswered: Get subform to display info based on user's input

    I need to build a form that has the capability of the user typing in a company name and a subform shows all the information for that company.

    However, there are multiple records that have the same company name and I need all of those records to be displayed when the company name is entered.

    How do I go about setting this up? All I have right now is a table and I need to create this form.

    Thanks for all the help.
    Last edited by CTChris; 06-04-09 at 10:44.

  2. #2
    Join Date
    Feb 2004
    Posts
    214

    ...

    You actually have your answer in your post.
    In your main form you will have a combo box with the different company names, then you will create a subform that links the combo box value to your table. You will likely want to add some vb code to refresh the subform if the combo box changes value.
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

  3. #3
    Join Date
    Jun 2009
    Posts
    95
    Mr. Blonde,

    How do I create a subform that links to the combo box value to my table?

    That relationship setup is what I am struggling with.

    Thanks

  4. #4
    Join Date
    Feb 2004
    Posts
    214

    ...

    when you are making your main form, use a table that contains your list of company names as your datasource. When you draw on your subform and pick the table or query you are wanting, it will prompt you asking how you want to make your connection between the subform and the main form.

    Other way to go about it is to have no datasource on your form. Have your combo box go to your table and have your subform based on a query of the table that you want. In the query the company id criteria will something like this =[Forms]![YourFormName]![YourComboboxName]. Then on your form, make your subfrom visible = false. On the combobox use the on_change function and write some code to say if comboboxname = null, then subform.visible = false
    else
    subform.visible = true


    Either way should work.
    You know, I'm sick of following my dreams, man. I'm just going to ask where they're going and hook up with 'em later

Posting Permissions

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