Results 1 to 7 of 7
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Update a subform

    On a form, I have a subform which is based on a query. The user makes a selection on the form, the query is run, and the sub-form is set to visible.

    I allow the user to re-select without exiting the form. If the user re-selects, I set the sub-form visible to false. After the user makes the selection, the query is run, but when the sub-form is visible, it contains the previous query results.

    In my testing, before I set the sub-form to visible again, I've tried this code:
    me.frm_PM_Changes_subform_ID.Requery



    But it doesn't make any changes on the sub-form.

    Thanks in advance for your help!!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What do you mean 'the query is run'. Should requery the subform, not 'run' the query.

    Post code or db for analysis.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Within the attached DB, forms in question are frm_PM_Changes & frm_PM_Changes_subform_ID

    You'll need to open frm_Menu_Reports_Variance to properly open frm_PM_Changes.
    Attached Files Attached Files

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I tried running your database.

    Get errors for missing/misspelled Reports.

    Which buttons are we suppose to click to see the issue?

  5. #5
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    1. Open form frm_Menu_Reports_Variance
    2. Select Position Management Changes
    3. Search option, Position ID
    4. From the Position ID drop down, select one of the numbers
    5. From the Change Type list box, select any of the options
    6. Click on view report

    The query that this subform uses is not being executed before this subform is visible

    Thanks

  6. #6
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    I figured it out. Within cmdViewReport, after the CreateData, I added these two lines of code.


    Me.frm_PM_Changes_subform_ID.Form.RecordSource = strQry
    Me.frm_PM_Changes_subform_ID.Form.Requery

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Combo box in subform won't update
    By TCS222 in forum Forms
    Replies: 2
    Last Post: 11-17-2012, 12:23 PM
  2. Replies: 1
    Last Post: 11-07-2012, 05:31 PM
  3. How to update a subform
    By krcmd in forum Programming
    Replies: 2
    Last Post: 10-10-2012, 07:13 PM
  4. SubForm Update
    By libraccess in forum Forms
    Replies: 2
    Last Post: 05-02-2012, 07:02 PM
  5. Update field in table after update on a subform
    By jpkeller55 in forum Queries
    Replies: 3
    Last Post: 09-30-2010, 08:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums