Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2006
    Posts
    9

    Question Unanswered: same old "Data has been changed error message", way around this?

    Hi people...

    My very last (fingerscrossed) hurdle before I have my first database done. Essentially is running fine, but Ive got the same old problem.
    "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."

    Im workin on Access 03, with latest Jet installed. My db is a member contact database. It runs from one form. The problem is encountered when using my search fields. The way I have set it up - user searches records, results populate a listbox, reports run from the listbox. In order to define my selections for reports etc. I added a field to my underlying table PrintY_N. If it is set to True, it is eligible for a report, if it is set to N it is ignored for reports. My buttons essentially switch this field true/false. like this:

    search button. Switches all matching results to TRUE
    Refresh button. switches all matching results to FALSE
    Refine button. Switches selected records to TRUE.

    with me so far? (Is this a logical way to run things?)

    But everytime I try to do a new search etc. it pops up the mentioned error message. Although it has no effect. My db is running smoothly. Can anyone suggest a way of switching this error message off/autoanswering it/insert a save point/ or something that will ignore it....

    please and thankyou...

  2. #2
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    Quote Originally Posted by Plink
    Hi people...

    My very last (fingerscrossed) hurdle before I have my first database done. Essentially is running fine, but Ive got the same old problem.
    "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."

    Im workin on Access 03, with latest Jet installed. My db is a member contact database. It runs from one form. The problem is encountered when using my search fields. The way I have set it up - user searches records, results populate a listbox, reports run from the listbox. In order to define my selections for reports etc. I added a field to my underlying table PrintY_N. If it is set to True, it is eligible for a report, if it is set to N it is ignored for reports. My buttons essentially switch this field true/false. like this:

    search button. Switches all matching results to TRUE
    Refresh button. switches all matching results to FALSE
    Refine button. Switches selected records to TRUE.

    with me so far? (Is this a logical way to run things?)

    But everytime I try to do a new search etc. it pops up the mentioned error message. Although it has no effect. My db is running smoothly. Can anyone suggest a way of switching this error message off/autoanswering it/insert a save point/ or something that will ignore it....

    please and thankyou...







    First off I think something isnt designed right if you are having that issue. You didnt ask my opinion however so I am going to give you an idea on how to ignore the error.

    You need to build in error handling for your code. For example add this to your code where you think you are getting the error:



    On error goto errhandler ' this is your first line of code


    '''''''your code here


    exit sub 'place this at the end of your code

    errhandler:

    select case err.number
    case is = <the error number you are getting>
    resume next ' do nothing
    case else
    msgbox err.desc, vbCritical, err.number
    end select

  3. #3
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I have found that it is do to a record changing on a form or subform (the user changes it) followed by an automated process changing the same record. Typically you can avoid this issue by saving the record the user is changing (maybe a check box was checked) using the command:

    DoCmd.RunCommand acCmdSaveRecord

    Run this command to save the record the user may or may not have changed, then run your automated updates (ex. changing all checks to false).

  4. #4
    Join Date
    Jun 2006
    Posts
    9
    Hey guys... thanks for the replies...

    Terp.. all opinions welcome.. im very open to suggestions, thanks. In terms of ur solution, Im not sure it fits the situation, as I don't think its strictly an error message, no error number etc. plus I switched off the warnings before the procedure and back on after.

    DCKunkle, thanks for the response, I think you are on the right track, its happening because Im switching that PrintY_N field on and off several times in the process.

    Ill be working on the problem tomorrow, if you're interested Ill be posting any results.

    Thanks again guys.

  5. #5
    Join Date
    Jun 2006
    Posts
    9
    okay... easy enough solution at the end of the day ..

    inserted a me.requery wherever the data had been changed. Sorted it out perfectly, only a bit of screen flicker to contend with, can live with that tho.

    thanks

  6. #6
    Join Date
    Jul 2004
    Location
    Blackburn, UK
    Posts
    169
    Ill just add to this, usually it is because you are modifying the table instead of the form with code.

    If you where to run an update query on a field that affected the current record while you where in it then you would get that problem.

    I would suggest modifying the forms control instead with code, so tick and un tick the box on the form instead of using the update query.

    I feel that errors like this should not be ignored or use a work around but they should be done properly.
    Based on DAO 3.6 and Access 2000 + 2003
    VB.Net 2005 + ADO.Net

  7. #7
    Join Date
    Mar 2016
    Posts
    3

    I am the one updating the data, but not records that are on the screen.

    I am getting this message also. I know for a fact I am the one updating the data in VBA code behind the scenes. I also know I am not updating fields that are on the form, there for using 'me.' is out. I tried the .requery, but this is a list of records, the .requery resorts the screen (as it should do) so the user has to hunt for the record he wants to edit.

    This is a royal pain, and there SHOULD be a way to control this. Yes the warning is OK, but sometimes we are doing what we need to do because that is the way it has to be done. Warning the user about something the programmer has put in place and tested is of no help to anyone.

    Anyone found a way I can get the VBA to update a record and tell access to just let things carry on as if nothing happened?

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so limit the data in your forms recordset
    or make certain you don't update any data in that recordset
    or take a note of the current row, refresh the dataset after your update query, then repostion to waht was the current row
    or redesign your schema
    or use another application environment such as .NET, JAVA or a web scripting language such as PHP, RUBY or similar.
    or use the set warnings macro to disable warnings, but alwasy make certain you turn warnings back on when whatever taks has completed. having warnings off and developing code is a sure fire way to madness

    bear in mind Access is not a purists language, it tries to do a fair bit of work under the hood and sometimes its optimisiations can seem quirky. but its origins go back to late 80's early 90's, in applciation language tersm nearly the dark ages
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •