Results 1 to 11 of 11
  1. #1
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29

    Lock all records on subforms when form is being edited

    Hi,

    I have an split databse access file that I am using in a multi-user environment.



    My main form (Customer Information) has 2 other subforms (Products and Services). I am trying to prevent users from editing the same records at the same time. My problem is that if I am editing the main form, then the subform is open for editing and vice versa.

    Also, while the main form in only 1 record, the subforms potentially show 5 or 6 records (datasheet view) each. I would like to make it so that if any record is being edited, that all the records shown are locked to prevent other users form editing it at the same time.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    chd.locked = true

    afterupdate of record
    chd.locked = false

    (chd is your sub form name)

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Does your business flow allow situation where multiple users will need to edit same record and/or its related records at same time?

    I also have a multi-user split database and this is not a concern for us because there is no need for multiple users to look at same record at same time.

    Record Locking is a property found in the application Client Settings. I don't if this can be managed programmatically.

    EDIT: I see ranman has offered some code. However, I don't see how setting the subform container Locked property will actually lock the records against other users running their copy of the frontend.
    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.

  4. #4
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29
    While the users won't actually need to edit the same records at the same time, I do have a lot of non tech savvy users and I want to prevent any possible chance that two users could edit the same record at the same time.

    Is there any way I can check if the main form is being edited? Or lock specific records based on certain values as all 3 tables are linked via their order number.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Since every user should be independently running their own copy of frontend, how could you check what each user is doing?

    If, on the rare occasion, multiple users attempt to edit same record at same time, Access should trigger message.
    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.

  6. #6
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29
    Well I was thinking that I could have the code check to see if the record is being edited and set the subforms as disabled if they are. Or at the very least have msgbox to pop up to alert the user the someone else is using that record.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Alert which user? Disable subforms in which user frontend? I have never seen any code to do this.
    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.

  8. #8
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29
    A user would receive a message like "The Record is being edited by another user" or something or that sort. I am not that familiar with VBA coding so it was just a thought. Whether it is possible or not is beyond me.

    I just figured since access is somehow checking that the current record is being edited, there might be some sort of VBA code to check as well perhaps.

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Is this a split db with each user running their own copy of the frontend?
    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.

  10. #10
    PicoTTS is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2016
    Posts
    29
    yes it is. The back end will be stored on the server.

  11. #11
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    I don't know of any way to code for checking what each user is working on in their copy of frontend.

    I suppose there is (or used to be) a way for LAN administrator to send message to all logged on users. At university, I remember students doing some kind of IM over the LAN. http://www.fomine.com/net-send-gui.html

    But you are using dropbox so I expect any messaging in your case would involve sending an email.
    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.

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

Similar Threads

  1. Replies: 11
    Last Post: 05-13-2015, 11:10 PM
  2. Form - records showing can not be edited
    By lowesthertz in forum Forms
    Replies: 8
    Last Post: 02-06-2015, 12:42 PM
  3. Replies: 9
    Last Post: 05-12-2012, 12:16 PM
  4. Replies: 5
    Last Post: 06-29-2010, 06:10 AM
  5. form not letting records be edited
    By stuart rose in forum Forms
    Replies: 3
    Last Post: 09-02-2009, 04:22 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