473,805 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write Conflict Woes

14 New Member
Good afternoon, Byte'rs!

I'm running into an annoyance that, utilizing the framework I am, has been causing me grief. In a nutshell:

-Access 2003 Compiled ADE application
-SQL Server 2005 backend
-15 concurrent users

Normally our application has very specific workflows that handle how users get assigned specific records they're responsible for updating. This works well, because it pushes criteria to a Stored Proc that runs on the server, grabbing available records and putting them in a user's pipeline.

However, we've come across a situation that required us to bypass this process, and assign records to my users manually (by assigning, that means updating a text field with their initials which the application uses for workflow).

The problem we're having is that if two users go into the "Open" pipeline to manually grab a record, if two users grab the same record and start making udpates, when the second person goes to update they recieve the write conflict error.

I'm trying to come up with a way to have Access "look" to see if the record is updated before any changes are entered, but short of having a master LOCK / UNLOCK button that stores the locked status in a separate locking table, I'm coming up empty.

Any suggestions? :)
Sep 9 '09 #1
14 3332
NeoPa
32,579 Recognized Expert Moderator MVP
I guess not understanding what you are referring to by "pipeline" is causing me to find the question a bit confusing.

Is it a standard linked table?

How does your structure fit together (a brief explanation please)?
Sep 9 '09 #2
adversus
14 New Member
Yeah, sorry about that.

The "pipeline" is a user's queue, it's basically a recordset pulled down into the application for specific criteria, whatever the user selects (usually something like, "give me data set 1, data set 2, where the assign_box is my initials").

In this case I've got tables joined together. Updates are only being applied to the Right table (using a LEFT JOIN) that's created from a stored procedure and that SP is used as the record source of the form.

So essentially what I'm trying to do is prevent two users from modifying the same record.
Sep 9 '09 #3
NeoPa
32,579 Recognized Expert Moderator MVP
Maybe I'm still not getting something.

If your SP that provides the data for the pipeline as seen by each individual is in control of which data is sent, presumably on the basis that each record is only owned by one individual, then how can it send the same record concurrently to two different requestors?

Even assuming this is not quite working as expected then surely this is a problem with the SP rather than the Access portion of the project.

Maybe you can explain what I'm missing. It may be simply "the whole picture" of course, but let's see where we can get.
Sep 9 '09 #4
adversus
14 New Member
The problem is that user's can bypass their own pipeline and go out into a queue that does not have any assignments. In other words, records that are not already flagged by a user.

The problem I'm having is when this happens and two users modify the same record out of this data set, that the problem occurs.
Sep 10 '09 #5
NeoPa
32,579 Recognized Expert Moderator MVP
So the pipeline you're having problems with is a different one from the one you described in post #3 :S
Sep 10 '09 #6
adversus
14 New Member
Fair point. That's what I get for typing furiously in between meetings :)

Basically, how do I prevent two users who retrieved the same record from the server from causing a write conflict if they both do updates before the record gets refreshed/saved from the server.
Sep 10 '09 #7
NeoPa
32,579 Recognized Expert Moderator MVP
Well again, I don't see that this is a particularly Access issue here. I still don't have much of an understanding of the relevant pipeline, but guessing from what else you've said, it must be a queue of some sort provided by the SP that has no user level criteria associated.

This takes us back to the basics. If you want to provide such protection with your SP then fine, though we cannot generally help with that here (We don't even know what algorithms you're using - apart from it being non-Access in nature).

As far as Access record-locking goes, that is selected from the Options screen of the Tools menu. I'm really not sure that it even effects ODBC tables though.

Am I on the right track here? I'm not getting a sense that communication is going very well.
Sep 10 '09 #8
adversus
14 New Member
Yeah I apologize for that. It's been one of those weeks. I'm usually way easier to understand :)

Let me start over to clarify:

The form in question (and it is only one form) is bound to a stored procedure, lets call it "SP1". SP1 accepts several parameters, which it uses as criteria for a series of SELECT statements to retrieve the particular data a user requests. For example:

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE [dbo].[SP1]
  2.    (@p_cParm1 CHAR(15) = NULL
  3.    ,@p_cParm1 CHAR(75) = NULL
  4.    ,@p_vAssigned VARCHAR(4) = NULL)
  5. AS
  6.  
  7. BEGIN
  8.    SELECT * FROM dbo.some_table
  9.    WHERE (@p_cParm IS NULL OR some_field = @p_cParm1)
  10.    AND (@p_cParm2 IS NULL OR some_field2 = @p_cParm2)
  11.    AND (@p_vAssigned IS NULL OR LTRIM(RTRIM (assgn_cd)) = @p_vAssigned)
  12. END
It's much longer and more complex than this, with more parameters, but this is the gist. Essentially the SP will return to access a record set from the SELECT statement, which is built with the criteria passed. In our case, the Assigned parameter may or may not be passed, and if it's left NULL, all records that match Parm1 and Parm2 are returned, regardless of the Assigned field status.

Now assume two users call this SP within minutes of each other without supplying the Assigned parameter. They may get the same record(s). Access retrieves the record set and uses this to populate the form (using the form's .InputParameter s property). The same record is now displaying on two user's applications.

One user then modifies the record, and closes the form or navigates away which causes Access to push the update to the server. The second user does the same, and recieves a Write Conflict error, because they both had pending edits before one user saved.

The part I'm stuck at is figuring out a mechanism to have the application (i.e. Access) do one of the following:

1. Keep track of when a record becomes "locked" for editing, which can be displayed to the user, or
2. Something else I can't think of

Clear as mud? :)
Sep 10 '09 #9
ADezii
8,834 Recognized Expert Expert
@adversus
I have an idea, but I'm not exactly sure as to whether or not it will work. This simple process will be illustrated below. The majority of the code will be encapsulated within a Function, a simple Call to the Function will suffice. The general idea is to:
  1. Create a Clone of the Current Form's Recordset which is based on the Stored Procedure.
  2. Sync the Clone to the Form's Current Record by equating Bookmarks.
  3. Attempt to Edit the Clone. If the Record is Locked, an Error should occur, the Function returns True (is Locked), and then the Function is exited. If not, then the Function returns False.
  4. Check the return Value of the Function being sure to pass the Current Form as an Argument to the Function.
  5. Sounds good in theory, I'll let you actually try it and let me know if it actually works! (LOL)!
  6. Function Definition:
    Expand|Select|Wrap|Line Numbers
    1. Public Function fIsRecordLocked(frm As Form)
    2. Dim rst As DAO.Recordset
    3. On Error GoTo HandleErr
    4.  
    5. 'Clone the Form's Recordset and synch up to the
    6. 'Form's Current Record
    7. Set rst = frm.RecordsetClone
    8. rst.Bookmark = frm.Bookmark
    9.  
    10. 'If the Current Record is locked, then the next
    11. 'statement should produce an Error that we will trap.
    12. 'The Error Value should be 3188.
    13. rst.Edit
    14.  
    15. fIsRecordLocked = False
    16.  
    17. ExitHere:
    18.   Exit Function
    19.  
    20. HandleErr:
    21.   fIsRecordLocked = True    'Probably Locked (3188)
    22.     Resume ExitHere
    23. End Function
  7. Typical Call to fIsRecordLocked ():
    Expand|Select|Wrap|Line Numbers
    1. If fIsRecordLocked(Me) Then
    2.   '..Record is Locked
    3. Else
    4.   'Record not Locked
    5. End If
  8. Kindly let me know how this turns out.
Sep 11 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
94553
by: Max | last post by:
Hi, I have SqlServer 2000 as back end and Access 2000 as front-end. All tables from Sqlserver are linked to Access 2000. I am having write conflict problem with one of my form which is bound to a query which consist of let say tableA , TableB and TableC (all are linked tables from SqlServer. While the form is open I am modifying TableA through code on Form_AfterUpdate Event and getting the following message.
2
15424
by: RC | last post by:
I am getting the following error message. "Write Conflict this record has been changed by another user since you started edting it. If you save the record, you will overwrite the changes...." I have an Access 2002 database running on a single PC, the front and backend have not been separated yet. I have a form where I use a text box to jump from record to record. The form has about 12 bound text boxes on it. The table that is the...
1
3088
by: shumaker | last post by:
I've loked over older messages on this, but haven't found a solution. I have a datasheet of records, and each record has a subform that can be viewed with the expand '+' symbol. The subform simply shows addition fields of the record it is expanded from. I used the subform control wizard to tell it how to link the records when creating the subform. There is only one control in the subform that the users can edit, a textbox. All the...
5
4732
by: Simon | last post by:
Dear reader, I have two Forms they are both working with dada from the same tables. By typing in some changes in Form-B the changes are also visible in Form-A. There is no record lock set.
1
3755
by: Kuriandungu | last post by:
Hi guys I've read the posts on Write conflict entered in this forum (along with some from kbAlertz and microsoft) and i have tried all the solutions without success. let me give you some background. i have an access form bound to a customers table in sql. the table in sql has an index on the customer code and has an autoincrement field generated by sql (rowid). i have also put a time stamp field. My Access form does not add any records to...
4
8509
by: crystal | last post by:
I've checked the threads but haven't been able to come up with a solution to my issue. Help...... I have a simple form based on a table. Within the form is a subform that is also, through a Q, based on the same table. The code: Private Sub Select_BeforeUpdate(Cancel As Integer) On Error GoTo resetselect_Err
1
2450
by: lorirobn | last post by:
Hi, I have a query that I have been using as a record source for a form with no problems. I just created a new "addnew" form, and added 20 records to the table with this form. The problem I now have is I cannot modify data on these new records using my query. The query's sql is: SELECT tblSpaceUse.* FROM tblSpaceUse; The error I get is: "Write Conflict -
8
12952
by: christianlott1 | last post by:
After searching the group and the net, I just can't believe after all this work I'm going to have to sit through three Write Conflict messages when I want to roll back and delete a record. The action rolls back a new hire record, deleting it from a joining table between employee and position - tblPosEmpRecord. It's a many to many join. The new hire action updates the employee with a new position and logs
1
4034
by: S.Dickson | last post by:
I have a database with access as front end and Mysql as back end. I am gettting the following 'Write Conflict' Error. when i am on my order form, This form does has a subform where i enter all the products that are ordered. Could any one let me know what could cause this problem. I am the only one using the database as its still in the build stage Thanks
0
9596
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
10360
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10366
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
10105
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
9185
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
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3007
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.