Solved

Saving Subform record Problem

Posted on 2014-01-25
3
1,313 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

708 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

16 Experts available now in Live!

Get 1:1 Help Now