Results 1 to 4 of 4

Thread: Subform help

  1. #1
    Join Date
    Jun 2003
    Posts
    19

    Unanswered: Subform help

    First, thanks for the wonderful help I have received from the members of this forum.

    Here my problem.
    I have never worked with subforms before, and now I am running into a wall. I need help setting up a subform to diplay the data from a table linked in a many to many relationship.


    Program_ID
    Prog_Name

    Program_ID
    Started
    Complete
    Require_ID

    Require_ID
    Requirements


    My main form has been passed a Prog_Name and cooresponding Program_ID. On that main form I also have a combo box allowing a user to select a Requirement/Require_ID. I would like my subform to show the started and completed data for each Program_ID/Require_ID combination.

    I have been able to display the two ID's on the subform, but when a user changes the Require_ID from the combo box, the subform does not add a record for the new combination, it just updates the Require_ID field and leaves the rest of the data the same. No new record.

    Any help you can offer me is appreciated.

    Thank you in advance.

    Steve

  2. #2
    Join Date
    Dec 2003
    Posts
    18

    Re: Subform help

    Hi there.

    It sounds like you're missing one line of code. Your code in the AfterUpdate event for the ReqID/Requirements combo box probably has the following:

    Me!YourComboBoxName.RowSource = strSQL

    You need to add the following:

    Me!YourComboBoxName.Requery

    This will refresh the data when a new item is selected in the combo box.

    Hope this helps.

    Amadea

  3. #3
    Join Date
    Dec 2003
    Posts
    18

    Re: Subform help

    Ooops, made an error in the code. Sorry.

    The added line should read:

    Me!NameOfYourDisplayedDataBox(s).Requery


    You didn't say how the record info was being displayed. I think that makes a difference. If you use text boxes, make sure you created the combo to "search for a record", then you won't need additional coding; if your using a list box, then you'll need a little code in the AfterUpdate event of the combo box.

    Let me if this makes sense.

    Amadea

  4. #4
    Join Date
    Jun 2003
    Posts
    19

    Thank You

    Thank you Amadea. Seems to work great. Your comments pointed me in to right direction and I used your requery code.

    Thanks for your help,

    Steve

Posting Permissions

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