General discussion

Locked

VBA Over-write / Saving problem

By CF Guerrilla ·
Anyone have experience? Help! I have to modify a lousy
wizard-generated permit-issuing program to require a second user login
and password to "void" a permit once issued. There's a main form, and
sub form involved, with permit details on the sub form, permittee and
"amounts paid" on the main form. When I update a permit to "Void"
status on the sub form, all works okay, including setting the "paid"
text boxes on the Main form to "$.00" (though not yet "saving" such
changes to the database.) The problem comes when I lose focus from the
sub form back to the main form (by clicking anywhere outside the sub
form.) I get a system generated pop-up that says "Write conflict:
another user has modified this record since youbegan editing it.
Either click 'Save Changes', and overwrite the other users changes, or
"Drop changes", or "Copy to clipboard" to see the changes the other user
made." I get this whether I do my DoCmd.DoMenuItem, acRecordMenu,
acSaveRecord, etc. on the sub form, or on the main form (in the Private
sub OnExt_SubForm() event function). Anyone have any ideas? I've
consulted books, help and four other VB programmers here - and no luck.
Thanks.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

VBA Over-write / Saving problem

by VinnyD In reply to VBA Over-write / Saving p ...

This sounds like your main form opens the records in Edit mode and then you are opening the sub form also in the edit mode for the same record.

Before calling the sub form, the main form must update or unlock that record.

Collapse -

VBA Over-write / Saving problem

by CF Guerrilla In reply to VBA Over-write / Saving p ...

Poster rated this answer

Collapse -

VBA Over-write / Saving problem

by LorraineR In reply to VBA Over-write / Saving p ...

Have your sub-form save the data prior to exit (make the sub-form modal so you cannot leave the sub-form any other way than YOUR exit button) then have it do a refresh on the data on the main form before exiting.

Collapse -

VBA Over-write / Saving problem

by CF Guerrilla In reply to VBA Over-write / Saving p ...

Poster rated this answer

Collapse -

VBA Over-write / Saving problem

by MadestroITSolutions In reply to VBA Over-write / Saving p ...

I think I may know where the problem is:

You are opening 2 different recordsets, 1 to display the form, 1 for the sub form right? if this is the case, then when you modify something in the sub form, and go back to the form, the subform recordset is trying to update the information (deactivate event most likely), but since you have code that has modified the first form, the other recordset has changed too, so its asking you to overwrite the changes. Use only one public recordset for both forms, or combine them into one. If this doesnt help you, then check the recordset LockType property:

adLockPessimistic Pessimistic locking, record by record?the provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately upon editing.

adLockOptimistic Optimistic locking, record by record?the provider uses optimistic locking, locking records only when you call the Update method.

Good luck and hope that helps

Collapse -

VBA Over-write / Saving problem

by CF Guerrilla In reply to VBA Over-write / Saving p ...

Poster rated this answer

Collapse -

VBA Over-write / Saving problem

by CF Guerrilla In reply to VBA Over-write / Saving p ...

This question was closed by the author

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums