Getting The data has been changed message

B

Bob

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
 
T

Tom Wickerath

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
__________________________________________

:

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
 
B

Bob

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
 
Top