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

P

Plink

HI...

Can I impose for another problem? If I can get this licked, my first database
is done and dusted!

Ill fill you in. Im searching for records, viewing results in a listbox, and
populating reports from the listbox on one page. The user experience is like
this:

-Open database, search fields are empty, listbox is populated with every
record.
-Wants to do a search of records, fills in search fields which populates
listbox with matching records.
-Wants to run a report of only SOME of the matching records, clicks on
relevant records individually, hits report buttons.
-Wants to do a new search, hits Refresh button.
ETC.

Ive probably constructed it wrong, but here is my solution: (All records have
a PrintY_N field)

-Open database, all records are switched to Print= True
-On Searching, only matching records are Print=True
-On selecting SOME matching records , all records are switched to Print=False,
and selected records only switched back to Print=True.
ETC.

I hope you get the general idea of my methods. It runs perfectly well, quite
happy with the solution, but of course what happens is if I mess about with
the search sequences etc, I get the message we're all familiar with "Data has
been changed by another user" . it doesn't throw any problems except it
forces the user to reselect some records. Ideally I would just switch this
message off completely, is this possible? Ive been trying to add a docmd.save
in before updates and after updates and stuff, but nothing doing.

...........help?
You
 
A

Allen Browne

DoCmd.Save won't work. That does not save the record: it only saves any
design changes to the form.

To save the record in the form, try:
If Me.Dirty Then Me.Dirty = False
This works even if the form does not have focus.

Do that explicitly before anything the requires an implicit save, such as
executing an Update query on the same data, opening a report, closing the
form, closing the database, finding or moving to another record, setting the
form's Filter or OrderBy or RecordSource, and so on.
 
P

Plink

Hi Allen,

Good tip on docmd.save, thanks. Ive been very liberal with the me.dirty code
u suggested, splicing it in everywhere, doesn't seem to have any effect.

Any other ideas? Do you think my approach has been all wrong? And, if you get
a chance, could you take a look at my other posting re. searching derived
field. Thanks
 
A

Allen Browne

There are several things that can cause this error, including older versions
of JET that have been patched. You might want to check that all users have
at least version 4.0.8xxx.0 of msjet40.dll. More info:
http://support.microsoft.com/kb/239114

Other than that, it usually comes down to multiple unsaved copies of the
data, or trying to move record without explicitly saving.
 
P

Plink via AccessMonster.com

Well, as described in my initial post, the message pops while manipulating
that printY_N field for populating reports. Essentially there are 3 buttons
performing this.

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

Then my reports read the PrintY_N field to see if it is eligible for the
report.

Ive inserted your me.dirty at the start of the code for each button, without
any result. Do you think my method is a good one? Im fairly sure my JET is up
to date.. Any thoughts on how to just switch that message off completely?

Thanks Allen.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top