How to handle Error #3197 (Data has changed; operation stopped)? 
Author Message
 How to handle Error #3197 (Data has changed; operation stopped)?

The following code updates the object variable mds (a dynaset)

.
.
.
    On Error Resume Next

    ' Update database
    mds.Edit
    mds.Fields("DATE") = txtDate
    mds.Fields("TIME") = txtTime
    mds.Fields("GROUP") = cboGroup.Text
    mds.Fields("CATEGORY") = cboCategory.Text
    mds.Fields("DESCRIPTION") = txtDescription.Text
    mds.Update

    If Err <> 0 Then
        MsgBox Error$   (I keep getting Error 3197 when other user has
        Exit Sub         changed the same record.)
    End If

    On Error Goto 0
.
.
.

If another user has made changes to the same record, I get Error 3197.

My applications specs allow me to overwrite the changes made by the other
user;  how do I handle this?.

TIA,

--
J. Padron

--



Sun, 19 Oct 1997 03:00:00 GMT
 How to handle Error #3197 (Data has changed; operation stopped)?

Quote:

>The following code updates the object variable mds (a dynaset)
>    On Error Resume Next
>    ' Update database
>    mds.Edit
>    mds.Fields("DATE") = txtDate
>    mds.Fields("TIME") = txtTime
>    mds.Fields("GROUP") = cboGroup.Text
>    mds.Fields("CATEGORY") = cboCategory.Text
>    mds.Fields("DESCRIPTION") = txtDescription.Text
>    mds.Update
>    If Err <> 0 Then
>        MsgBox Error$   (I keep getting Error 3197 when other user has
>        Exit Sub         changed the same record.)
>    End If
>    On Error Goto 0
>If another user has made changes to the same record, I get Error 3197.
>My applications specs allow me to overwrite the changes made by the other
>user;  how do I handle this?.

Check out article Q113953 "How to Use Three Levels of Database Locking in VB
3.0" in the Knowledge Base.  It tells you how to handle this.  You can get a
copy of it from ftp.microsoft.com.

Justin Smith



Mon, 20 Oct 1997 03:00:00 GMT
 How to handle Error #3197 (Data has changed; operation stopped)?
What you need to do is another mds.Edit. I ran into this about 3 days ago.
This is what you will need to do.

Original Code;

  On Error Resume Next

    ' Update database
    mds.Edit
    mds.Fields("DATE") = txtDate
    mds.Fields("TIME") = txtTime

Modified Code

  On Error Goto Error_Handler

    ' Update database
    mds.Edit
    mds.Fields("DATE") = txtDate
    mds.Fields("TIME") = txtTime
......
Error_Handler:
If err=3197
  mds.Edit
  Resume Next
else
  'Any other error handling you want to do......
endif



Tue, 21 Oct 1997 03:00:00 GMT
 How to handle Error #3197 (Data has changed; operation stopped)?

: If another user has made changes to the same record, I get Error 3197.

: My applications specs allow me to overwrite the changes made by the other
: user;  how do I handle this?.

The simplest way to avaoid this is to use PESSIMISTIC LOCKING. In
PESSIMISTIC mode, as soon as someone attempts to edit a record, it
is locked and no on else can access it. Problem is that you can
get a pile of 'Locked by another User' messages that are a real
pain.

Next option is to save the update values in a set of variables. Then
attempt an update. If you get the 3197 error, run the
<recordset>.UpdateControls to restore the record from the data table,
then pound your values from the stored variables into the data fields.

This should work - but I haven't tested it.

Any other ideas out there?

MCA

+-------------------------------------------------------------------------+

| Voice....: 513/381-4610                 FAX.....: 513/421-9657          |
| SnailMail: Aviation Planning Assoc, Inc. 421 Arch St. Cinti, OH  45202  |
+-------------------------------------------------------------------------+



Wed, 22 Oct 1997 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Error 3197 Data has changed operation stopped

2. Error 3197 - Data has changed, operation stopped - singleuser

3. Need help Re: Possible Causes For 3197 - Data Has Changed - Operation Stopped

4. Indexes with NULL coulmns causes error 3197 - Data Has Changed

5. error 3197: data has changed

6. Problem w/ Data has changed Error #3197

7. visual basic error code 3197 ( DATA HAS CHANGED)

8. Data has changed error 3197

9. Help Needed: VB ERROR 3197: DATA HAS CHANGED; OPERATION STOPPED

10. What is Error: 3197 Data has changed operation stopped?

11. Error 3197 The microsoft jet engine stopped because you and another user are attempting

12. Error 3197, the jet database stopped


 
Powered by phpBB® Forum Software