Results 1 to 8 of 8
  1. #1
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038

    Subform's rowsource does NOT refresh

    Hello Experts:



    I understand much has been posted about "refreshing subforms". Yet, based on posted solutions, I still don't seem to be able to address my curren issue.

    The attached DB includes the following objects:
    1. Table "src_Data" (source data)
    2. Query "Q100_ViewData" (row source for subform)
    3. Main form "F100_ViewData"
    4. Subform "F101_ViewData_Subform"

    Existing Process:
    - Upon opening the main form "F100_ViewData", select both a) value from radio buttons and b) item(s) from listbox. Then click command button "Execute Query" (EQ).
    - Clicking the EQ command button recreates "Q100_ViewData".
    - Unfortunately, once I change values for either radio buttons AND/OR listbox, the subform is NOT updated (upon clicking the command button).

    I tried all of the six following VBA commands:
    Code:
        'Forms![F100_ViewData]![F101_ViewData_Subform].Requery
        'Forms!F100_ViewData!F101_ViewData_Subform.Form.Refresh
        'Forms![F100_ViewData].[F101_ViewData_Subform].Form.Requery
        'Me!F101_ViewData_Subform.Form.Requery
        'Me![F101_ViewData_Subform].Requery   
        Forms!F100_ViewData!F101_ViewData_Subform.Form.Requery
    Neither of them seem to work for me. Could someone please assist and provide the correct VBA code which will refresh the subform's row source/data once values in radio button/listbox have changed AND I click on the "Execute Query" command button?

    Thank you,
    EEH
    Attached Files Attached Files

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Reload the subforms recordsource;

    Me.F101_ViewData_Subform.Form.RecordSource = "Q100_ViewData"
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Minty -- perfect!!! Thousand thanks for providing a solution so promptly!

  4. #4
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Quick follow-up question... somewhat unrelated to the topic though.

    I changed the subform's fontsize from, e.g., "11" to "9" (or even "8"). However, when I bring up the mainform (with subform) the subform's fontsize appears to be unchanged (still "11"). Any quick thoughts how I make decrease the subform's fontsize?

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    I was thinking of
    Code:
       Me.F101_ViewData_Subform.Form.RecordSource = strSQL
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Welshgasman -- wow, that one works too and I wouldn't have to change the query name (in the event its name is changing). Great!!

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    skydivetom is offline VIP
    Windows 8 Access 2010 64bit
    Join Date
    Feb 2019
    Posts
    1,038
    Thank you all for the contributions... works like a charm now. Cheers!!

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

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2018, 02:23 AM
  2. Replies: 5
    Last Post: 07-08-2014, 07:47 AM
  3. combobox rowsource per row on a subform
    By kowalski in forum Access
    Replies: 2
    Last Post: 12-05-2012, 01:49 AM
  4. Replies: 2
    Last Post: 09-21-2012, 05:42 PM
  5. Replies: 15
    Last Post: 11-09-2010, 04:27 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