Solved

Saving Subform record Problem

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

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…
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

773 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