Results 1 to 8 of 8
  1. #1
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    linking form and subform (2k)

    I have created the following database and need some advice regarding a few details.

    First the number in the third combo, isn't chooseable, it is what it is, how would i be able to get rid of it?

    Secondly, currently the choice of combo boxes causes a Query to run, but does not affect the subform until i reopen the form. How would i link the form to the query to the subform?
    Attached Files Attached Files

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: linking form and subform (2k)

    Can you explain what you are trying to do.

    It looks like you want to filter a form.

    Do you want the user to have to make a choice from all 3 combos before seeing anything? or do you want the form to be filtered by any of the combos by itself?
    Regards
    John



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

    Re: linking form and subform (2k)

    You can include ID as a hidden first column in cmbSpecific, and link the subform to the main form on PID vs cmbSpecific.

    See the attached version.
    Attached Files Attached Files

  4. #4
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: linking form and subform (2k)

    Thanks, Doesn't do quite what i want though. I want to be able to have the contents of cmbspecfic defined by the contents of cmbzone according to tbldetail and then have frmfault update to display all occasions where these conditions are met.

    But what i would appreciate is an explanation of how the filter works, i can't see anything that explains how it has been set up?

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

    Re: linking form and subform (2k)

    Can you try to explain more clearly what you want? I don't understand in what sense the version I attached doesn't do that already.

    To see how the subform is filtered, open the main form in design view.
    Click once on the subform to select it. Don't click on it again, for that would select something in the subform.
    Activate the Data tab of the Properties window.
    You'll see that the Link Child Fields property is set to PID and the Link Master Fields property is set to cmbSpecific. This means that each time the user selects a value in the combo box cmbSpecific, the subform will automatically (without using any code) display the records having a PID equal to the value of cmbSpecific.

  6. #6
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: linking form and subform (2k)

    I think it got corrupted at some point, i re-downloaded and it did seem to work, not quite sure of what i did differently each time though.

    I have been working a little with it and have changed where the first drop down looks for data. The previous version only showed areas where data already existed rather than showing all areas. I am left with one question. I can search data in the tables but i seem unable to add data to the tables through the form, I get the error message "You cannot add or change a record because a related record is required in table 'tblZone'.

    Is this the form, how access handles data entry etc?

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

    Re: linking form and subform (2k)

    I'm afraid that I don't understand the structure of your database, in particular the relationship between tblLocation, tblZone and tblDetail.

  8. #8
    New Lounger
    Join Date
    May 2008
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: linking form and subform (2k)

    Thanks, I figured out where i had gone wrong and it is working now. It was the duplication of certain aspects of the database, things that should have been deleted hadn't been.

Posting Permissions

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