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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • daniel

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

    Hi All,

    I have a form and VB code in Access. The code is like


    With rs
    .Edit
    !Field = 10
    .Update
    End With

    When I chang a value on the form. then the error shows up.

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

    Anyone has idea what cause that? Thanks in advance.

  • KK

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

    In most cases, I have seen, this happens, if you have two subforms or
    forms linked to the same table. If you try to edit the table from a
    different form while the second form/subfrm (linked to the same table)
    is open. I would check to see if you have the corresponding table
    already open while this piece of code is running.


    daniel wrote:[color=blue]
    > Hi All,
    >
    > I have a form and VB code in Access. The code is like
    >
    >
    > With rs
    > .Edit
    > !Field = 10
    > .Update
    > End With
    >
    > When I chang a value on the form. then the error shows up.
    >
    > The data has been changed. Another user edited this record and saved
    > the changes before you attempted to save your changes. Re-edit the
    > record
    >
    > Anyone has idea what cause that? Thanks in advance.[/color]

    Comment

    • daniel

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

      I only have one main form.

      Comment

      • Danny J. Lesandrini

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

        Is the data in SQL Server and do you have any memo fields?

        --

        Danny J. Lesandrini
        dlesandrini@hot mail.com



        "daniel" <danielblw@gmai l.com> wrote...[color=blue]
        >I only have one main form.
        >[/color]


        Comment

        • salad

          #5
          Re: The data has been changed. Another user edited this record andsaved the changes before you attempted to save your changes. Re-edit therecord

          daniel wrote:
          [color=blue]
          > Hi All,
          >
          > I have a form and VB code in Access. The code is like
          >
          >
          > With rs
          > .Edit
          > !Field = 10
          > .Update
          > End With
          >
          > When I chang a value on the form. then the error shows up.
          >
          > The data has been changed. Another user edited this record and saved
          > the changes before you attempted to save your changes. Re-edit the
          > record
          >
          > Anyone has idea what cause that? Thanks in advance.
          >[/color]

          Any chance you are updating values in the AfterUpdate event? Is the RS
          using the Recordsetclone of the form? What exactly is RS?

          Comment

          • daniel

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

            Rs is defined as follows:

            squery = "SELECT * from Table1 where serial = " & !Serial
            Set rs = db.OpenRecordse t(squery, dbOpenDynaset, dbSeeChanges)


            and I do not have memo fields.

            Comment

            • daniel

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

              the data is in sql server.

              Comment

              • Danny J. Lesandrini

                #8
                Re: Ouch! that's a long subject line

                Daniel:

                Add a timestamp column to each table in SQL Server. It helps
                Access to determine if anyone has edited a record. This will
                solve your problem. Doesn't matter how you name the field, just
                put it out there and Access will find and use it.

                Of course, you'll probably have to refresh your table links
                so the new field(s) are visible.
                --

                Danny J. Lesandrini
                dlesandrini@hot mail.com



                "daniel" <danielblw@gmai l.com> wrote ...[color=blue]
                > the data is in sql server.
                >
                > The data has been changed. Another user edited this record and
                > saved the changes before you attempted to save your changes.
                > Re-edit the record[/color]


                Comment

                • daniel

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

                  the data is in sql server.

                  Comment

                  • salad

                    #10
                    Re: The data has been changed. Another user edited this record andsaved the changes before you attempted to save your changes. Re-edit therecord

                    daniel wrote:
                    [color=blue]
                    > Rs is defined as follows:
                    >
                    > squery = "SELECT * from Table1 where serial = " & !Serial
                    > Set rs = db.OpenRecordse t(squery, dbOpenDynaset, dbSeeChanges)
                    >
                    >
                    > and I do not have memo fields.
                    >[/color]
                    I guess I didn't ask the right question. Sure, RS is a recordset. Is
                    it updating fields that exist on the form?

                    You are providing such minimal data that at this point I can only say
                    that your problem could be caused by a great number of causes.

                    Comment

                    • daniel

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

                      yeah, I updateing the files exist on the form.
                      public sub cal()
                      squery = "SELECT * from Table1 where serial = " & !Serial
                      Set rs = db.OpenRecordse t(squery, dbOpenDynaset, dbSeeChanges)

                      With rs
                      .Edit
                      !Field1 = 10
                      .Update
                      End With

                      end sub
                      when I change field2 on the form, I call Cal(). If i change field2
                      again, then the error shows up.

                      Comment

                      • David W. Fenton

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

                        "daniel" <danielblw@gmai l.com> wrote in
                        news:1134667506 .911789.241680@ g14g2000cwa.goo glegroups.com:
                        [color=blue]
                        > yeah, I updateing the files exist on the form.
                        > public sub cal()
                        > squery = "SELECT * from Table1 where serial = " & !Serial
                        > Set rs = db.OpenRecordse t(squery, dbOpenDynaset, dbSeeChanges)
                        >
                        > With rs
                        > .Edit
                        > !Field1 = 10
                        > .Update
                        > End With
                        >
                        > end sub
                        > when I change field2 on the form, I call Cal(). If i change
                        > field2 again, then the error shows up.[/color]

                        Why are you using a separate recordset to update data that is
                        already opened in the recordset behind the form you're using to edit
                        it?

                        Secondly, if you *are* going to update the data through something
                        than the obvious method of changing the form's underlying data, why
                        in the world are you opening a recordset with .Edit and .Update
                        instead of just using a SQL UPDATE query:

                        UPDATE Table1 SET Field1=10 where serial = " & !Serial

                        That will be faster and hold a lock on the table a shorter period of
                        time.

                        But I question why you are doing this in the first place.

                        Why not just update the field in the form's underlying recordset?
                        Doing it your way is just asking for exactly the kind of problem
                        you're seeing.

                        --
                        David W. Fenton http://www.dfenton.com/
                        usenet at dfenton dot com http://www.dfenton.com/DFA/

                        Comment

                        • salad

                          #13
                          Re: The data has been changed. Another user edited this record andsaved the changes before you attempted to save your changes. Re-edit therecord

                          David W. Fenton wrote:[color=blue]
                          > "daniel" <danielblw@gmai l.com> wrote in
                          > news:1134667506 .911789.241680@ g14g2000cwa.goo glegroups.com:
                          >
                          >[color=green]
                          >>yeah, I updateing the files exist on the form.
                          >>public sub cal()
                          >>squery = "SELECT * from Table1 where serial = " & !Serial
                          >>Set rs = db.OpenRecordse t(squery, dbOpenDynaset, dbSeeChanges)
                          >>
                          >>With rs
                          >> .Edit
                          >> !Field1 = 10
                          >> .Update
                          >> End With
                          >>
                          >>end sub
                          >>when I change field2 on the form, I call Cal(). If i change
                          >>field2 again, then the error shows up.[/color]
                          >
                          >
                          > Why are you using a separate recordset to update data that is
                          > already opened in the recordset behind the form you're using to edit
                          > it?
                          >
                          > Secondly, if you *are* going to update the data through something
                          > than the obvious method of changing the form's underlying data, why
                          > in the world are you opening a recordset with .Edit and .Update
                          > instead of just using a SQL UPDATE query:
                          >
                          > UPDATE Table1 SET Field1=10 where serial = " & !Serial
                          >
                          > That will be faster and hold a lock on the table a shorter period of
                          > time.
                          >
                          > But I question why you are doing this in the first place.
                          >
                          > Why not just update the field in the form's underlying recordset?
                          > Doing it your way is just asking for exactly the kind of problem
                          > you're seeing.
                          >[/color]
                          Exactly.

                          Comment

                          Working...