Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-16-2018, 07:55 AM   #1
FrostByte
Newly Registered User
 
Join Date: Jan 2015
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
FrostByte is on a distinguished road
Prevent a row from being locked in certain cases

Hi,

I have a field called "Status" and if this is set to a certain value (e.g Awaiting Approval", I want to prevent users from locking a row out and making changes.

The reason for this is that managers routinely run update queries which set various values if they approve the input and if users are in said records, these updates of course fail (due to record locking behavior).


Kind Regards

FrostByte is offline   Reply With Quote
Old 08-16-2018, 08:44 AM   #2
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 1,491
Thanks: 14
Thanked 272 Times in 270 Posts
Mark_ will become famous soon enough
Re: Prevent a row from being locked in certain cases

Have a flag of some kind (or status, or what ever) that is checked when the user opens the form(s). If set, don't allow them to edit.
Mark_ is offline   Reply With Quote
Old 08-16-2018, 08:49 AM   #3
FrostByte
Newly Registered User
 
Join Date: Jan 2015
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
FrostByte is on a distinguished road
Re: Prevent a row from being locked in certain cases

Quote:
Originally Posted by Mark_ View Post
Have a flag of some kind (or status, or what ever) that is checked when the user opens the form(s). If set, don't allow them to edit.

Presuming this would require some VBA code set on "On Current"?

FrostByte is offline   Reply With Quote
Old 08-16-2018, 09:06 AM   #4
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 1,491
Thanks: 14
Thanked 272 Times in 270 Posts
Mark_ will become famous soon enough
Re: Prevent a row from being locked in certain cases

That depends on how you want to present this to your users.

You can either check PRIOR to opening the form (make all records 'Locked' blue or something) AND prevent the form from being opened in edit mode OR change the mode when they are moving through the records on your form(s).

It depends on how you are displaying data and how you are allowing users to select records. If you only allow them to view the data in data sheet mode prior to selecting a record for edit, THIS thread can help. If you are allowing a different way to select records, you will have to work out for each approach how you want to notify the user they can't edit data.
Mark_ is offline   Reply With Quote
Old 08-16-2018, 09:59 AM   #5
FrostByte
Newly Registered User
 
Join Date: Jan 2015
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
FrostByte is on a distinguished road
Re: Prevent a row from being locked in certain cases

Quote:
Originally Posted by Mark_ View Post
That depends on how you want to present this to your users.

You can either check PRIOR to opening the form (make all records 'Locked' blue or something) AND prevent the form from being opened in edit mode OR change the mode when they are moving through the records on your form(s).

It depends on how you are displaying data and how you are allowing users to select records. If you only allow them to view the data in data sheet mode prior to selecting a record for edit, THIS thread can help. If you are allowing a different way to select records, you will have to work out for each approach how you want to notify the user they can't edit data.
From experimenting with on current and using....

If me.field = "Y" then
Me.AllowEdits = False
end if

This doesn't work and I can fully edit records.
FrostByte is offline   Reply With Quote
Old 08-16-2018, 10:06 AM   #6
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 1,491
Thanks: 14
Thanked 272 Times in 270 Posts
Mark_ will become famous soon enough
Re: Prevent a row from being locked in certain cases

How are you calling the form?
Will the form allow you to navigate between records?
Is the form continuous? Datasheet? Other?

Without a very good idea of how you are allowing access to records the only advice I can give is rather general in nature.

Mark_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple cases zhuanyi Queries 1 07-10-2007 10:46 AM
Fault in SQL in some cases ?? sven2 Modules & VBA 1 05-03-2007 01:46 PM
cases open on given day Mike Hughes Queries 2 02-22-2006 09:41 AM
Cases take time JordanR Queries 4 09-13-2005 11:49 AM
Comparing cases aziz rasul Modules & VBA 4 07-10-2003 12:12 AM




All times are GMT -8. The time now is 03:34 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World