Results 1 to 3 of 3
  1. #1
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714

    Disable sub form until main form saved?

    I’m looking for a forms trick.
    I’ve got a main and sub form. Both forms have a lot of code and a “New” and “Save” button.

    The Save button in the main form assigns an ID and saves the record (along with a lot of other stuff). The main form needs to have the ID assigned and record saved before the sub form can proceed with its new records.

    If the main form hasn’t yet been saved, and the user clicks in the sub form (anywhere or any control), the BeforeUpdate for the main form runs and undoes the main form record (as saves are explicit). The sub form then crashes with code logic errors.

    So, I’m looking for a way to disable the sub form between the time the new button is pressed in the main form and the save button is pressed. It would be like forms(“subname”).enabled = false, but there isn’t such a thing (as far as I know). I can't just disable all the controls, as just pressing in the detail portion of the sub will also run the main's BeforeUpdate.



    Any ideas?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The subform container control can be enabled/disabled, locked/unlocked, visible/not visible.
    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
    twgonder is offline Expert
    Windows 10 Access 2021
    Join Date
    Jun 2022
    Location
    Colombia
    Posts
    714
    @June7 Thanks, it's been a while, I forgot about the "container". It didn't help that it had a strange name there for some reason. The simple test did disable it.

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

Similar Threads

  1. Replies: 15
    Last Post: 11-06-2021, 07:16 PM
  2. Replies: 39
    Last Post: 07-28-2018, 12:27 PM
  3. Replies: 10
    Last Post: 07-05-2017, 11:31 AM
  4. Replies: 2
    Last Post: 11-13-2012, 02:11 PM
  5. Replies: 9
    Last Post: 02-19-2010, 12:07 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