The data has been changed message

User avatar
Van
2StarLounger
Posts: 114
Joined: 28 Sep 2010, 21:13
Location: Melbourne, Oz

The data has been changed message

Post by Van »

Hi All,

I have a main form and a sub-form in a one-to-many relationship. all worked well when dB was stand alone. have now migrated tables to SQL server, and form behaving strangely. I am getting the following error message:

The data has been changed.
Another user edited this record and saved the changes before you attempted to save you changes.
Re-edit the record.

When i clear this message, the record can be edited. (by the way, the error only seems to occur when i've changed data on sub-form, then gone to main form and attempted to change data).

Is this an SQL server issue?

Thank you,
Van :scratch:

User avatar
HansV
Administrator
Posts: 78412
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: The data has been changed message

Post by HansV »

It has to do with changes to the SQL server tables not being instantaneous. Try creating an After Update event procedure for the subform:

Code: Select all

Private Sub Form_AfterUpdate()
    Me.Parent.Requery
End Sub
Best wishes,
Hans

User avatar
Wendell
4StarLounger
Posts: 482
Joined: 24 Jan 2010, 15:02
Location: Colorado, USA

Re: The data has been changed message

Post by Wendell »

In addition to Hans' suggestion, you will probably want to add a Timestamp field to each of your SQL Server tables. We've found that to resolve most of those kind of issues with SQL Server back-end tables.
Wendell
You can't see the view if you don't climb the mountain!

User avatar
Van
2StarLounger
Posts: 114
Joined: 28 Sep 2010, 21:13
Location: Melbourne, Oz

Re: The data has been changed message

Post by Van »

thanks Hans and Wendell.

I added the requery code and all works well now.

Regards,
Van