Solved

Error trying to update linked SQL Server table

Posted on 2011-09-08
3
255 Views
Last Modified: 2012-05-12
I am using the below code to try to edit a linked SQL server table from an Access front end.

It returns the following error:
Error 3197: The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time.

If I try to edit the record directly in the table, I receive the error in  the screenshot.  

 I am able to create records ok.

There are no other users in this database at any time.


With CurrentDb.OpenRecordset("SELECT * FROM dbo_TimeSheets WHERE TransactionID=" & Me.TransactionID, dbOpenDynaset, dbSeeChanges)
               
                   .Edit
                     !order = Me.order
                     !EmployeeID = Me.EmployeeID
                     !Labor_Date = Me.Labor_Date
                     !No_Of_Hours = Me.No_Of_Hours
                   .Update
                   .Close

    End With

Open in new window

write.bmp
0
Comment
Question by:snyperj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 500 total points
ID: 36505383
Hi,

in most cases this can be solved by adding a field to any table which is used by Access of type "timestamp". The problem is that often the datatypes are not converted correctly between JET and SQL Server and then there would be a difference between the original record and the edited one because in this case there is a field by field compare. With a timestamp SQL Server only looks into this field to compare the record.

Another reason why this error can occur is that a change in the code is the same as if another user had changed the record. So if you change the record directly while it is displayed in a form it's the same as if another user had changed something.

Cheers,

Christian
0
 
LVL 9

Expert Comment

by:borki
ID: 36505395
Not sure how you are linking to SQL, this might be the source of the problem, as the Jet engine can't control the server.

Personally I would be using an Update statement such as

dim sSQL as string

sSql = "UPDATE dbo_TimeSheets SET order = " & me.order & " WHERE TransactionID=" & Me.TransactionID"
Docmd.RunSQL (sSql)
0
 

Author Closing Comment

by:snyperj
ID: 36505924
Yes- that seems to have done it (adding the timestamp)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question