Results 1 to 3 of 3
  1. #1
    always404 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    19

    Manually Locking Records for Editing

    Is there some way I can lock a specific record in a table (or set of records in case there is a subform) through VBA.



    I know there is "edited record" locking but I am trying to do this manually for records that I specify.

  2. #2
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You cannot lock one or more Records in a Table; you can, however, lock the Controls on Forms that hold/display Records, and since interaction between users and Records should always be done through Forms, that's as it should be.

    You can either lock Records that fall within one or more conditions, such as Records that are 'complete,' or Records created before a certain point in time, etc., or you can add a 'Yes/No' Field to a Record and code so that if it is ticked the Record will be locked.

    What, exactly, do you have in mind, here?

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    always404 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2013
    Posts
    19
    Quote Originally Posted by Missinglinq View Post
    You cannot lock one or more Records in a Table; you can, however, lock the Controls on Forms that hold/display Records, and since interaction between users and Records should always be done through Forms, that's as it should be.

    You can either lock Records that fall within one or more conditions, such as Records that are 'complete,' or Records created before a certain point in time, etc., or you can add a 'Yes/No' Field to a Record and code so that if it is ticked the Record will be locked.

    What, exactly, do you have in mind, here?

    Linq ;0)>
    Yeah, I think after all that googling yesterday I had the feeling that might be case. It seems access handles the record locking itself; it is somehow as a feature of the framework and not so much as an explicit action. I don't know if i'm making sense but thats what it seems like.

    What I had in mind was a work around to some record locking issues that i mentioned in another thread. I wanted to check if an unbound control had focus and then set the current record to locked. I basically want the same functionality as record locking without access explicitly controlling the locks.

    I'm thinking what i'll do instead is, check if the record is locked with edit locks (i have to research a way to do this in vba), and set up a "locking" boolean so that there is a locking mechanism for the unbound form, and.... well this is really turning into a frankenstein project.

    I don't know, I'm going to see how far I get on this new path. But I think the question in my original post has been answered.

    Edit: for anyone trying to do what i did (lock a record without actually performing any edits), a workaround is to dirty the record by setting a field equal to itself.
    Last edited by always404; 02-01-2013 at 10:21 AM. Reason: a workaround added

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

Similar Threads

  1. Editing records
    By shariq1989 in forum Forms
    Replies: 1
    Last Post: 08-05-2012, 02:19 AM
  2. Adding/Editing Records through a subform
    By Antinomy in forum Forms
    Replies: 17
    Last Post: 06-30-2012, 07:29 PM
  3. Editing Records In Table Using Form
    By ffezz in forum Programming
    Replies: 3
    Last Post: 03-14-2012, 01:40 AM
  4. problem in editing records with visual basic
    By davidvhp in forum Programming
    Replies: 31
    Last Post: 12-05-2011, 07:36 PM
  5. Locking Records in Subform
    By MuskokaMad in forum Forms
    Replies: 1
    Last Post: 04-02-2010, 06:34 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