Solved

Saving Subform record Problem

Posted on 2014-01-25
3
1,321 Views
Last Modified: 2014-01-27
When leaving a subform I get write conflict. "Another user has changed the record. Save Drop or copy to clipboard".

In this subform I  set a main form field value from the subform. So it may be that the main form's record is needing saving rather than the subform's record? I can't seem to find the secret of how to do this.

I have a "Close" button on the subform that moves the focus to the main form and then sets the subform visible property to false. It is doing this that causes the error
0
Comment
Question by:DatabaseDek
3 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39808584
Most times that is caused by using VBA/SQL to modify the same record as you're viewing on the form or subform. I wouldn't imagine the main form record is dirty (it's saved when you move off the main form to the subform), but try saving your main form record:

Me.Parent.Dirty = False

Do this before the subform exit.

Also, if you're using VBA to work with the form (or subform) data you'll have to change that and make the data mods directly on the form. For example, instead of doing this:

Currentdb.Execute "UPDATE MyTable SET MyField=True WHERE RecordID=" & Me.RecordID

You'd just do:

Me.MyField = True

And let Access handle the saves.
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 39808871
No points, please!

Scott, I think that is exactly the problem.  The OP indicated that code in the sub form is modifying a value on the main form
0
 

Author Closing Comment

by:DatabaseDek
ID: 39811413
Thank you. Most helpful
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now