Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Posts
    9

    Unhappy Unanswered: ??updating query subform??

    HELP!

    I have a subform whose record source is a query. It's main form has a command button and a combo box. The value selected in the combo box on the main form dictates a piece of the criteria in the query that the subform is pulling from. The command button writes the SQL statement according to what is selected in the combo box. Here's my problem: How do I get the subform to refresh and show the new results of the query after executing the command button? Everything is working correctly, in that when I press the button on the main form the query is re-written with the value in the combo box. It's just not refreshing in the subform. It only refreshes when I close the main form and then reopen it. Is there any way to get the query to run AND refresh in a subform without having to close and reopen its parent form?? Thanks in advance for any help!!

    cj
    Last edited by cjwang80; 04-19-04 at 17:16.

  2. #2
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Refresh

    Try to add the following after updating your SQL statement

    [Forms]![frm-Main]![frm-Subform].Form.Refresh


    Best regards
    Vestigo

  3. #3
    Join Date
    Dec 2003
    Posts
    9

    Re: Refresh

    Originally posted by vestigo
    Try to add the following after updating your SQL statement

    [Forms]![frm-Main]![frm-Subform].Form.Refresh


    Best regards
    Vestigo
    tried it, still the same result. thanks for the help though. I don't get it, really. the query is rewritten and updated, but the subform that's pulling from it isn't getting updated. weird.

  4. #4
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271

    Troubles

    I had the same troubles in the past with a form I was working on. My way around it was kinda tricky/stupid... I used a macro or code that went to the previous record then right back to the next record. It works fine now.

    Hope that helps!

    Michael
    Gotta to do some code

  5. #5
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    LinkMasterFields

    Strange.

    Tryt his one:

    Forms![Frm-MainForm]![frm-SubForm].Form.LinkMasterFields = "Supplier_ID"

    Where "Supplier_ID" is the control on the main form where the sub form is linked to.

    sincerely
    Vestigo

  6. #6
    Join Date
    Apr 2004
    Location
    South Arica
    Posts
    125
    could you post the code from your command button click event. Once you have changed the subforms recordset, requery it, rather than refreshing.

    form_subfrm.recordset.requery

Posting Permissions

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