visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: General :: "error 3197" visual basic : jet database engine stopped


By: FiatLink Belgium  Date: 08/09/2005 10:37:27  English  Points: 20 Status: Answered
Quality : Excellent
Error 3197: When I try open the database I get this message (the database was working perfectly until yesterday): "The Microsoft jet database engine stopped the process because you and another user are attempting to change the data @ the same time."
Problem is: there is no-one else connected at the time and the dbase refuses to open. Help!! How do I fix this??

Have made sure the data is clean and that no records are screwed up.
Have run JETCOMP to see if that found anything. Have even exported
and imported the data into a new database.

All of the forms and sub-forms have the same Properties:
Recordset Type: Dynaset (Inconsistent Updates)
Record Locks: No Locks

The database Options (under Advanced) are set to:
Default Open Mode: Shared
Default Record Locking: No Locks
"Open databases using record-level locking" is checked.
By: VGR Date: 08/09/2005 10:47:49 English  Type : Answer
Hello. This famous Jet Engine error 3197 is discussed in this EEE.org PAQ where you will find all Microsoft-related data, but I gathered some more VB-specific details for you :

Quote from this old VB4 help page :

There are several possible errors that can occur within your Visual Basic program if you attempt to edit a record that is on a data page that is already locked. The most common errors you'll encounter are Error 3260 and Error 3197. Error 3260 occurs whenever you attempt to edit a record that is stored on a page that is already locked by another user or program. You can handle this error by attempting a read at another time. Error 3197 occurs when your program attempts to read a record that has been updated or deleted since you last refreshed the data set. You can handle this error by reloading the record into the data set (usually by invoking the Edit method again). Refer to Listing 14.38 as an example.


Listing 14.38. Handling page lock errors during edits. Public Sub PageLockErrors(LockErr As Integer) ' ' handle errors due to page locks ' Static nTries As Integer Dim nMaxTries As Integer Dim nLoop As Integer Dim nTemp As Integer ' nMaxTries = 3 ' Select Case LockErr Case 3197 ' data changed rsObject.Edit ' re-read changed record Case 3260, 3816 ' currently locked nTries = nTries + 1 ' try again If nTries > nMaxTries Then ' too manytimes? nTemp = MsgBox(Error, vbRetryCancel, "Error " + Str(Err)) If nTemp = vbRetry Then ' user said try again nTries = 1 ' start all over End If End If End Select ' DBEngine.Idle ' free up old locks DoEvents ' let messages catch up ' For nLoop = 1 To 2000 ' 2000 millisecond pause ' empty loop Next nLoop Resume ' End Sub



Notice the use of the Idle and DoEvents methods in the error handler in Listing 14.38. These two lines allow Visual Basic and Windows to pass any backlogged messages to each other that may relate to old page locks that are no longer active.



Regards

Do register to be able to answer

EContact
browser fav
page generated in 350.993870 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page