By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,889 Members | 1,259 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,889 IT Pros & Developers. It's quick & easy.

Run time error, "The data has been changed."

P: n/a
Hello All,

I have a popup form that is called from a command button on the main
form. The main form's data source is tblA. The data source for the
popup form is a query that is based on tblA. The OnClose event of the
popup attempts to change data in a text box on the main form if
certain changes have been made on the popup.

Because both use the same data source I have tried saving the record
before attempting to make the changes, I have tried refeshing both the
popup and the main form. I have tried all of these save attempts in
the following places: My own exit command button, form unload event,
form deactivate event, form close event. I continue to get the
"runtime error '-2147352567 (80020009)' The data has been changed."

The part that boggles my mind the most is that if I setup a save
button on the popup form and click that after making my changes and
then close the popup it works perfectly. If I put in a break in the
code and step through it, it works perfectly.

Any help would be greatly appreciated.

Bill
Newtown PA
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I have a LOT of forms that call other forms based on the same data source.

The trick is simply to make sure RIGHT BEFORE you launch another form, you
force a disk write. That way, the current record is written to disk, and
then here is NO pending write. You then simply launch that other form, in
your case the popup.
So.
me.Refresh
.....code to launch popup
..... popup form may modify data.
.... popup form close

We are back.

The above should just work fine. So, the real "trick" is to ALWAYS write out
the current record to disk RIGHT BEFORE you popup, or leave to another form.

While I always use me.Refresh, many of the more experienced developers here
have pointed out that the following code is better:

if me.Dirty = True then
me.Dirty = false
endif
--
Albert D. Kallal (MVP)
Edmonton, Alberta Canada
No************@msn.com
http://www.attcanada.net/~kallal.msn
Nov 12 '05 #2

P: n/a
Albert,

Thanks for the reply. I already run a save on the main form before
opening the popup. But that is not where my error occurs. It happens
when returning from the popup (if changes have been made on the popup).
Have you ever seen this situation where there is a runtime error but
when you put in a code break and step through there is no error?

Thanks,

Bill
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more Microsoft Access / VBA Questions on Bytes