Results 1 to 7 of 7
  1. #1
    KBNETGUY is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    26

    After Updating Subform

    Hey folks I have form with a subform. The subform on load doesn't allow edits. I have two button within the sub form. One named Edit (when pressed allowing users to edit) and another named Lock (when pressed not allowing the users to edit)



    What Im trying to also prevent is that if the user advances to the next Parent record with out clicking on the lock button then ullitmately there able to to begin editing the subform with having to press the Edit button. What on even can I use to prevent this

    Heres the Code:

    Code:
    Private Sub Form_Load()
            Me.AllowEdits = False
    End Sub
    
    Private Sub Edit_RawMaterial_Click()
    
    
            Me.AllowEdits = True
            MsgBox "You are about to edit these raw materials!"
    
    
    End Sub
    
    Private Sub Lock_RawMaterial_Click()
            Me.AllowEdits = False
            MsgBox "You are about to lock these raw materials!"
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The current event of the main form will fire when they change records.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    KBNETGUY is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    26
    Quote Originally Posted by pbaldy View Post
    The current event of the main form will fire when they change records.
    Actually I tried that the first time prior to me posting. If i advance the Parent form to the next record I would have thought that the Onload Event Procedure on the SUB-FORM (Private Sub Form_Load()) would have done what your saying but if I advance the parent record using the native navigation located at the very bottom of the main form then Im still able to edit the Subform contents:

    Click image for larger version. 

Name:	Screen Shot 2018-04-19 at 2.29.02 PM copy.png 
Views:	11 
Size:	36.3 KB 
ID:	33641

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The load event only fires when the form is first loaded. You need code in the main form's current event.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    KBNETGUY is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    26
    Not sure what code I would need? Any ideas. I can t use the same code thats in the subform onLoad but is there code that says Reload the Subform?

    I tried adding the following code to the Form_Current on the main form but still dow not work.

    [Batch Ingredients subform].Requery

    Thanks again!

  6. #6
    Beetle is offline Unrelatable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Camp Swampy (Denver, CO)
    Posts
    207
    You don't need to reload the sub form, you just need to set the AllowEdits property. In the Current event of the main form;

    Code:
    Me!YourSubformControl.Form.AllowEdits = False

  7. #7
    KBNETGUY is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Posts
    26
    You are correct. Thank you!

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

Similar Threads

  1. Replies: 2
    Last Post: 07-13-2016, 02:19 PM
  2. SubForm not updating after crash
    By gpsmith in forum Forms
    Replies: 2
    Last Post: 07-04-2015, 10:11 AM
  3. Help about updating subform record.
    By binbin in forum Forms
    Replies: 6
    Last Post: 04-09-2014, 05:38 AM
  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

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