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.
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.
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
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.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)>
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