?
Solved

Error trying to update linked SQL Server table

Posted on 2011-09-08
3
Medium Priority
?
257 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 2000 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

Industry Leaders: 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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

770 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