save action failed on form with multi users

G

Guest

Hello, I've an interesting problem. I'm using access 2002 SP3

I have a form which displays all the records in a table, with all sorts
of filtering options and sorting available for the user..There is one value
field which the user can update..however they must update this field via
another form - which pops up when they click on the field.
In this form they can modify the value using either an increment or a new
value. Plus there is a comment field. The comment is logged into an audit
table with the primary key field values and the user and date and time.
This all works fine..except when I start two instances of the database.
Then I cannot save the changes to the form. I get the error "save action
cancelled".
I have stripped away the audit log code. same problem. I have removed the
onClick code in the main form...and made the change directly to the value on
the main form. this works. I can update the values , and the change is
reflected in the other instance.
This "editing form" as I call it..is based on the same table. with some
dlookup fields on it. and the code to do the save without the audit is very
basic...

sub Onokclick()
docmd.save
docmd.close
end sub


the form properties is allow everything edits, deletions, additions etc..
dynaset and editedrecord for locking.

the form is opened with the acformedit keyword.

The problem occurs with any record, even with different records in the
two instances.

I've been able to get around it by updating the recordsetclone. But still
wonder why it doesn't work as designed. This most likely would have worked
fine in Access 97.

Any clues as to where I'm going wrong with this form?


Elvis
 
A

Allen Browne

Access 2000 and later do indeed save objects differently than 97 and
earlier. They perform a monolithic save - writing ALL the objects again when
you make a design change. Naturally that does not work properly if you are
already (and modifying) the database in a different instance.

If you have a valid reason for opening two instances of the same mdb, split
the database, make a 2nd copy of the front end connected to the same back
end, and open ONE instance of each one. This way you can do whatever you
like in each instance without messing up the other one.

Not sure if you are aware, but
DoCmd.Save
does not save the record. It saves design changes to the form.
 
G

Guest

Yes you are correct. Change the docmd.save to runcommad accmdsaverecord
did the trick. why then does docmd.save work in single user?

Elvis
 
A

Allen Browne

Elvis said:
why then does docmd.save work in single user?

This is one of the great unknown questions of the universe.

For a list of the others, consult the Hitchhikers Guide to the Galaxy.

:)
 
A

Allen Browne

Eric, the flippant reply was not meant to minimize your question.

As I think you now understand, DoCmd.Save is not intended to save the
record, so that fact that it did so was just a fluke - a side effect that is
clearly not reliable in other scenarios.
 

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