Reputation: 551
I have a formular a_form
which has a data binding to my table my_table
.
If the user clicks a button, I want to update my field txt_mytext
from "Hello"
to "Hello World!"
How can I update this field without getting the write conflict:
This record has been changed by another user since you started editing it. If you save the record, you will overwrite the changes the other user made. Copying the changed to the clipboard will let you look at the values the other user entered, and then paste your changes back in if you decide to make changes.
I tried the folowing methods:
a_form!txt_mytext = "Hello World!"
. It's not clear for my why I'm getting the write confict using this method.Is there any third method or do I have to call Me!Requery
, Me!Refresh
, Me!Dirty
... to avoid the write conflict ?
My code in frm_a_form
is:
Private Sub btn_calculate_Click()
Forms!a_form!txt_mytext = "Hello World!"
End Sub
Upvotes: 1
Views: 159
Reputation: 97101
I don't understand why you were getting a write conflict. However, in your own answer, you reported this works:
Forms!a_form!txt_mytext = "Hello World!"
Since that works, do the same thing from the click event of your command button on that form:
Private Sub btn_calculate_Click()
Me!txt_mytext = "Hello World!"
End Sub
If you want to save that change immediately, add this to the click event procedure:
Me.Dirty = False
Upvotes: 1
Reputation: 551
This seems to work:
Forms!a_form!txt_mytext = "Hello World!"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
I found this out randomly by googeling around e.g http://www.tek-tips.com/viewthread.cfm?qid=446217
Please feel free to explain this solution or to add your own answer.
Upvotes: 0