473,769 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Warn user-2 if user-1 on requested record

Using Access 2003 and using a form that's mostly bound. I need a way
to tell if user-1 is on the record when user-2 tries to open the same
record, w/o waiting for the user-1 to save the record first. The only
way I can think of is by adding a flag to the record and setting it to
true when user-1 opens the record. If user-2 tries to open it, the
flag is checked for true, then a message would be displayed to them
that user-1 is on the record. When user-1 saves the record, then the
flag is set to false.

Is this a good way to do this? Thanks for any help or advice.
Sep 16 '08 #1
19 4029
No, that's what record locking is for. Change from "no locks" to "edited
record". The record will be locked for all users who try to edit the record
once another user starts editing. The lock will be released after the first
user saves the record.

Chris
Microsoft MVP
em******@kumc.e du wrote:
>Is this a good way to do this?
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200809/1

Sep 16 '08 #2
On Sep 16, 11:17*am, "Chris O'C via AccessMonster.c om" <u29189@uwe>
wrote:
No, that's what record locking is for. *Change from "no locks" to "edited
record". *The record will be locked for all users who try to edit the record
once another user starts editing. *The lock will be released after the first
user saves the record.

Chris
Microsoft MVP

emann...@kumc.e du wrote:
Is this a good way to do this?

--
Message posted via AccessMonster.c omhttp://www.accessmonst er.com/Uwe/Forums.aspx/databases-ms-access/2008...
I have "Edited Record" selected already. Some more info on this
database.....it 's a split database connected to SQL Server 7. The
form is a mixture of bound and unbound fields. The user selects a
patient from a combobox which then refreshes the form with the
patient's info.

I appreciate your reply. Let me know if there's anything else I can
tell you about the database.

Sep 16 '08 #3
I don't think you'll see any effect on the SQL Server tables when "edited
record" is selected, because it's a setting that applies to Jet tables if the
db was opened with row level locking set.

You can control record locking when you create recordsets with the
adLockPessimist ic and dbPessimistic attributes, but that isn't going to help
with the bound forms - so you may want to reconsider your design. Depending
on your SQL Server settings and how your SQL Server database structure is
designed, you may be able to control record locking with the isolation level.
See the BOL for ideas and examples.

If your tables are designed for pessimistic locking, you can create a
clustered index on a column that will make it more likely popular rows (read:
high traffic) are scattered throughout the table instead of sequentially to
help avoid contention due to updates and inserts on the same data page. You
can reduce the fillfactor on indexes on tables for the same effect.

Chris
Microsoft MVP
em******@kumc.e du wrote:
>On Sep 16, 11:17Â*am, "Chris O'C via AccessMonster.c om" <u29189@uwe>
wrote:
>No, that's what record locking is for. Â*Change from "no locks" to "edited
record". Â*The record will be locked for all users who try to edit the record
[quoted text clipped - 9 lines]
>--

I have "Edited Record" selected already. Some more info on this
database.....i t's a split database connected to SQL Server 7. The
form is a mixture of bound and unbound fields. The user selects a
patient from a combobox which then refreshes the form with the
patient's info.

I appreciate your reply. Let me know if there's anything else I can
tell you about the database.
--
Message posted via http://www.accessmonster.com

Sep 16 '08 #4
Greetings,

I will guess you are using ODBC as your connection source to the Sql
server and operating the linked tables the same as if they were Access
tables. This is fine and doable. But as you are seeing/experiencing -
there are limitations to operating in this manner - particularly in a
multi-user environment.

I went through a phase where I started becoming somewhat critical of
Access as a front end to sql server, but I have lightened up on that.
Here is a workaround suggestion if you are using an mdb (or acc whatever
they are calling Access2007 DB's now if you are on Acc2007).

You can sort of treat the mdb like a .Net system where you pull a
record(s) from the server table to a local table - perform your
edit/update operations locally, and then re-submit the local record back
to the server table using DAO (if you want to keep everything local) or
ADO (which in my experience shows more performance less contention
issues). This method simulates the disconnected paradigm of .Net even
with ODBC tables (which are continuously connected to the mdb). It
reduces dead locking contention issues significantly.

Assuming the server tables have referential integrity constraints in
place you won't have to worry about duplicate entries and other
contention issues with this method.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Sep 16 '08 #5
Rich P <rp*****@aol.co mwrote in news:12******** *****@news.news feeds.com:
You can sort of treat the mdb like a .Net system where you pull a
record(s) from the server table to a local table - perform your
edit/update operations locally, and then re-submit the local record back
to the server table using DAO (if you want to keep everything local) or
ADO (which in my experience shows more performance less contention
issues). This method simulates the disconnected paradigm of .Net even
with ODBC tables (which are continuously connected to the mdb). It
reduces dead locking contention issues significantly.
Sequence of events:

1. Mary pulls the record to her local table;
2. Fred pulls the record to his local table;
3. Mary edits the record;
4. Mary submits her edited record to the server which saves it;
5. Fred edits his copy of the record, which does NOT have Mary's changes,
because he pulled it before Mary did her save;
6. Fred submits his edited record to the server which saves it.

What happens to Mary's changes?

--
-
lyle fairfield
Sep 16 '08 #6
On Sep 16, 4:15*pm, lyle fairfield <lylef...@yah00 .cawrote:
Rich P <rpng...@aol.co mwrote innews:12****** *******@news.ne wsfeeds.com:
You can sort of treat the mdb like a .Net system where you pull a
record(s) from the server table to a local table - perform your
edit/update operations locally, and then re-submit the local record back
to the server table using DAO (if you want to keep everything local) or
ADO (which in my experience *shows more performance less contention
issues). *This method simulates the disconnected paradigm of .Net even
with ODBC tables (which are continuously connected to the mdb). *It
reduces dead locking contention issues significantly.

Sequence of events:

1. Mary pulls the record to her local table;
2. Fred pulls the record to his local table;
3. Mary edits the record;
4. Mary submits her edited record to the server which saves it;
5. Fred edits his copy of the record, which does NOT have Mary's changes,
because he pulled it before Mary did her save;
6. Fred submits his edited record to the server which saves it.

What happens to Mary's changes?

--
-
lyle fairfield

Thanks for your replies.

Sep 17 '08 #7
This all depends on the Ref-Int and key setup. If the data entry people
have guidelines to follow and one person submits their entries before
the other- the 2nd person will get a key violation error -
theoretically

Here is where I start getting critical of Access as a front end to sql
server - slice it anyway you want - but Access just cannot trap most of
the error messages from the sql server. This observation is based on my
experience and hours upon hours of trying to figure out why we were
having data entry problems til we migrated to .Net which is much better
at catching all sql server errors.

On the flip side, since Access has the limitation of not being able to
catch all of the sql server errors - I guess it doesn't matter what
method is used except - be careful!

Access is actually fine as a front end for data entry to a sql server
table - but for error trapping and enforcing data entry rules - this is
the part where I have had problems using Access as a front end against a
sql server. And the OP is having the same problems.

Access is a great tool, but against a sql server - that changes.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
--
Posted Via Newsfeeds.com Premium Usenet Newsgroup Service
----------------------------------------------------------
http://www.Newsfeeds.com

Sep 17 '08 #8
In theory, if referential integrity is set and keys are set then if
user1 edits/updates data this user will get an error message from the
sql server if the business rules are not met - usually some key
violation error. Lets say user1 edits/updates data and then user2
edits/updates the same data 1 millisecond after user1 using the method I
suggested. If user2 is following the company's business rules and
enters the same data then this user will likely get some key violation
message of duplicate data - the record already exists. But if user2 is
actually changing the data that User1 just edited - meaning user2 came
along after user1 - say an hour later - it doesn't matter if my method
is used or if User2 edits the data directly in the table.

The problem with Access here is that Access just can't read most of the
error messages from the sql server. It just can't. Slice it/dice it -
argue till you are blue in the face - Access can only read about 20-30 %
of error messages from the sql server. I have had debates with other
Access people inhouse at my place who insisted that I was wrong. To
date - no one has been able to show otherwise. .Net on the otherhand,
is the new generation of technology which includes sql server
interactivity and has specifically addressed these issues successfully
- 100%.

Bottom line - Access is a great tool - but against a sql server backend
- must proceed with great caution. It is all doable - just a lot of
advanced functionality is not available in Access for dealing with sql
servers. So I guess my method does not really present any advantages
over editing/updating data directly from the table. Except if migration
to .Net is in the works - this method will at least get you started
using the .Net paradigm.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
--
Posted Via Newsfeeds.com Premium Usenet Newsgroup Service
----------------------------------------------------------
http://www.Newsfeeds.com

Sep 17 '08 #9
I give up.

Rich P <rp*****@aol.co mwrote in news:k8******** *********@newsf e04.iad:
In theory, if referential integrity is set and keys are set then if
user1 edits/updates data this user will get an error message from the
sql server if the business rules are not met - usually some key
violation error. Lets say user1 edits/updates data and then user2
edits/updates the same data 1 millisecond after user1 using the method
I
suggested. If user2 is following the company's business rules and
enters the same data then this user will likely get some key violation
message of duplicate data - the record already exists. But if user2 is
actually changing the data that User1 just edited - meaning user2 came
along after user1 - say an hour later - it doesn't matter if my method
is used or if User2 edits the data directly in the table.

The problem with Access here is that Access just can't read most of the
error messages from the sql server. It just can't. Slice it/dice it -
argue till you are blue in the face - Access can only read about 20-30
%
of error messages from the sql server. I have had debates with other
Access people inhouse at my place who insisted that I was wrong. To
date - no one has been able to show otherwise. .Net on the otherhand,
is the new generation of technology which includes sql server
interactivity and has specifically addressed these issues successfully
- 100%.

Bottom line - Access is a great tool - but against a sql server backend
- must proceed with great caution. It is all doable - just a lot of
advanced functionality is not available in Access for dealing with sql
servers. So I guess my method does not really present any advantages
over editing/updating data directly from the table. Except if
migration
to .Net is in the works - this method will at least get you started
using the .Net paradigm.

Rich

*** Sent via Developersdex http://www.developersdex.com ***



--
-
lyle fairfield
Sep 17 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
18887
by: Jamie Jackson | last post by:
I've got a form that's nested in a larger application. I need to program it so that the user is warned to save upon clicking on any exit point in the application. So, if they click on any of the nav buttons in the header/nav bar, they need to get an alert: "Would you like to continue without saving your changes?" _Yes_ _No_
65
3002
by: PengYu.UT | last post by:
Hi, Sometimes, I write = instead of == in if conditions by mistakes. Is there any way the gcc compiler can give me a warning? Best wishes, Peng
0
1093
by: Elmo Watson | last post by:
Why would my Trace.Warn statements be Red (as I expect them to be) in some pages, and only black in others?
2
2086
by: funkyj | last post by:
I've been googling around trying to find the answer to this question but all I've managed to turn up is a 2 year old post of someone else asking the same question (no answer though). http://groups.google.com/group/comp.lang.python/browse_frm/thread/8004c690b8c4db53/81e460a0ee8b03a5?lnk=st&q=python+warnings+echo&rnum=6#81e460a0ee8b03a5 jh> In the following jh> jh> import warnings jh> warnings.warn('change me')
89
6074
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
2
2590
by: tshad | last post by:
I have a page with Trace.Warns statements in my Page_Load and functions that it calls, but it doesn't seem to work in a class that is defined on the same page. I am writing this in C# I am getting the following error at the 1st Trace.Warn: *********************************************** Compiler Error Message: CS0118: 'System.Web.UI.Page.Trace' denotes a 'property' where a 'class' was expected
0
1495
by: Eric Sosman | last post by:
Tomás Ó hÉilidhe wrote: <digression> That's not just unspecified, it's undefined: It both modifies `p' and reads it (for a purpose other than computing the new value), without a sequence point between the two accesses. There's a sequence point between the evaluation of `*p' and the invocation of ConvertToLowercase(), and there's another sequence
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.