Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004

    Unanswered: Form linked to subform


    my question is how to link a form to a subform so that depending a choice made in the form, the data in the subform adapts accordingly.
    F.e. :
    Two tables :
    Product Contract
    ID ID
    Name ProductID
    ... Name

    The relationship between the tables is made by ID (table Product) and ProductID (table contract) with enforce ref. integr.

    I would like to have a form with in the main form a combobox with the names of the products and a subform beneath that will give all the clientsinfo based upon the choice made in the productname.
    So, say they are two products WWS and WWP.
    I choose WWS in the main form and the subform gives me all the clients who have this product. I can add or change this info.
    Afterwards I choose WWP etc...

    Can anybody give me some good advice on how to program this...?

    Many thanks,


  2. #2
    Join Date
    May 2003
    Here is one way to make this work....
    On the combo box, have the following as the rowsource

    SELECT ProductID, ProductName FROM Product

    Under the AfterUpdate of this combo box, have the following script

    Me.subformname.Form.RecordSource = "SELECT * FROM contract WHERE productID = " & me.combobox

    Hope this helps.


  3. #3
    Join Date
    Jun 2003
    Provided Answers: 1
    Can't you just set the Link Child Fields and Link Master Fields properties?
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

Posting Permissions

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