Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Getting The data has been changed message

Discussion in 'Information Technology' started by Bob, Nov 7, 2005.

  1. Bob

    Bob
    Expand Collapse
    Guest

    Form using bound textbox as well as a combobox
    textbox is bound to table1.field1 combobox is a lookup in table2

    In a button click event on the form, if I write

    Textbox = "123456"
    DoCmd.GoToRecord , , acNext

    This works fine,

    However if I replace the assignment
    Textbox = "123456" with

    textbox = GetNewValue(Someparameter) this GetNewValue does a lookup in
    table2
    (opens a DAO recordset, Dynaset type, finds a fieldvalue, increments it,
    does an edit then an update,closes the recordset and returns the incremented
    value), works fine

    But after it returns the value the asigment to textbox does not work, I get
    an error message data has been changed.

    Can anyone help me with this how do I assign the returned value?

    Thanks,

    Bob
     
  2. Loading...


  3. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    Hi Bob,

    If I understand you correctly--and I'm not sure I do--requery your form's
    recordsource so that it will know of the new value added.

    Tom

    http://www.access.qbuilt.com/html/expert_contributors.html
    __________________________________________

    "Bob" wrote:

    Form using bound textbox as well as a combobox
    textbox is bound to table1.field1 combobox is a lookup in table2

    In a button click event on the form, if I write

    Textbox = "123456"
    DoCmd.GoToRecord , , acNext

    This works fine,

    However if I replace the assignment
    Textbox = "123456" with

    textbox = GetNewValue(Someparameter) this GetNewValue does a lookup in
    table2
    (opens a DAO recordset, Dynaset type, finds a fieldvalue, increments it,
    does an edit then an update,closes the recordset and returns the incremented
    value), works fine

    But after it returns the value the asigment to textbox does not work, I get
    an error message data has been changed.

    Can anyone help me with this how do I assign the returned value?

    Thanks,

    Bob
     
  4. Bob

    Bob
    Expand Collapse
    Guest

    I got it solved I think

    If you have a form opened and positionned on a record and use code in a
    another module to update and save some of the same data as that which is
    currently displayed on the form. Then the changes in the module are made to
    a fresh recordset that is opened and closed in the separate module code or
    if you execute an TSQL update statement in the separate module, the form
    seems to consider that change made in the separate module in the same way as
    a change made by another user. So it behaves by telling you someone else
    changed the data but in reality it was you and it should be OK.

    One way I solved it was by bringing the lines of code actually doing the
    change inside the form's own code and use a private function in the form's
    own code.

    Now what I want to do works.

    Bob




    "Tom Wickerath" <AOS168 AT @comcast DOT net> wrote in message
    news:4F331BE9-BB66-43B2-AC2B-B9E4E39E001C@microsoft.com...
    > Hi Bob,
    >
    > If I understand you correctly--and I'm not sure I do--requery your form's
    > recordsource so that it will know of the new value added.
    >
    > Tom
    >
    > http://www.access.qbuilt.com/html/expert_contributors.html
    > __________________________________________
    >
    > "Bob" wrote:
    >
    > Form using bound textbox as well as a combobox
    > textbox is bound to table1.field1 combobox is a lookup in table2
    >
    > In a button click event on the form, if I write
    >
    > Textbox = "123456"
    > DoCmd.GoToRecord , , acNext
    >
    > This works fine,
    >
    > However if I replace the assignment
    > Textbox = "123456" with
    >
    > textbox = GetNewValue(Someparameter) this GetNewValue does a lookup in
    > table2
    > (opens a DAO recordset, Dynaset type, finds a fieldvalue, increments it,
    > does an edit then an update,closes the recordset and returns the
    > incremented
    > value), works fine
    >
    > But after it returns the value the asigment to textbox does not work, I
    > get
    > an error message data has been changed.
    >
    > Can anyone help me with this how do I assign the returned value?
    >
    > Thanks,
    >
    > Bob
     

Share This Page