Results 1 to 3 of 3
  1. #1
    demaionewton is offline Novice
    Windows 10 Access 2021
    Join Date
    Sep 2022
    Location
    Raleigh, NC
    Posts
    5

    Question Subform Field not updating


    Got a tricky situation I could use your help with. I have a subform that I want a field that is conditionally formatted based on a value that I don't want to display on the subform ([Status] field exists in the subform's table). I have a button on the form that updates the [Status] value using the following code:


    CurrentDb.Execute "UPDATE [Groups Master] SET Status = " & Me.cboGroup.Column(7) + 1 & " WHERE GroupID = " & Me!GroupID.Value

    The code works and updates [Status] correctly, but the value on the subform doesn't update. I suspect it's because I'm using CurrentDB.Execute to update the database on the back end and that doesn't refresh the current subform. I thought using Me.Refresh would pull the updated value into the subform. Nope.. I also tried requery to see if I could get it to pull the new value. No luck. If I close and reopen the form, the field is updated to the correct value.

    How do I pull the updated value into the current subform?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Where is the button located - on subform? Refresh should work or try Me.Requery

    or

    CommandBars.ExecuteMso "DataRefreshAll"


    Does the SQL update multiple records?
    Last edited by June7; 06-02-2023 at 10:58 PM.
    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
    moke123's Avatar
    moke123 is online now Me.Dirty=True
    Windows 11 Office 365
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    try Me.yourSubformName.Requery
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

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

Similar Threads

  1. updating a field based on value in a subform
    By Khalil Handal in forum Forms
    Replies: 2
    Last Post: 03-11-2020, 05:16 AM
  2. Replies: 2
    Last Post: 07-13-2016, 02:19 PM
  3. Replies: 7
    Last Post: 03-02-2014, 08:47 PM
  4. Replies: 1
    Last Post: 11-07-2012, 05:31 PM
  5. updating subform
    By cgrinage in forum Access
    Replies: 1
    Last Post: 08-21-2012, 05:38 PM

Tags for this Thread

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