Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Write Conflict
J David Bacon 
    
3 years ago
I have a Bank Reconciliation Form (Continuous) which displays a field in the ReconciliationT (Table) labeled ClearFlag. The ClearFlag is displayed on the Form as a CheckBox, TripleState is No. The CheckBox value is used to determine if the selected transaction has cleared the bank (0=No, -1=Yes). The AfterUpdate Event is used to Update the underlying table and update the Reconciliation Form via SQL.  I am getting a Write Conflict message when the AfterUpdate Event is run. I am using MS365 on a standalone computer. See the AfterUpdate code below:

Private Sub ClearFlag_AfterUpdate()
    '
    '      Clear/Unclear Selected Transaction
    '
    DoCmd.SetWarnings False
    clearSql = "UPDATE ReconciliationT SET ReconciliationT.ClearFlag = txtClearFlag WHERE TransID= txtTransID"
    DoCmd.RunSQL clearSql
    clrTrans txtReconType
    DoCmd.SetWarnings True
    
End Sub

Any help will be greatly appreciated.

Note: TransID is a ShortText Field in the TransactionT which  Identifies the selected transaction on the ReconciliationF.
Kevin Robertson  @Reply  
          
3 years ago
If TransID is Short Text you will need to use Double Double Quotes

clearSql = "UPDATE ReconciliationT SET ReconciliationT.ClearFlag = txtClearFlag WHERE TransID=""" &  txtTransID & """"

Are you setting the value of a Yes/No field equal to the value of a text box? This may also be causing problems.
Scott Axton  @Reply  
        
3 years ago
The first thing I would do is comment out the DoCmd.SetWarnings False line temporarily until you are sure you are working properly.

The warning / error message being generated may give you additional information that will be helpful.

J David Bacon OP  @Reply  
    
3 years ago
I added the Double Double Quotes around the appropriate text boxes and I am still getting the Write Conflict message. The field name ClearFlag is a CheckBox and when the box is checked (value is ether 0 or -1), the Message appears.  It is my understanding the Write Conflict occurs when there are two (2) updates to the same field by two (2) different VBA Codes at the same time.  However, this is a Standalone Access Program, so I am confused as to why this is happening.

Any other suggestions...?

In the mean time, I will review the videos regarding the use of Check Boxes.
Kevin Robertson  @Reply  
          
3 years ago
Possibly because you are updating ClearFlag twice. The After Update event and the Update statement. Try it with a button. If you don't get any errors that is probably the reason.
J David Bacon OP  @Reply  
    
3 years ago
Thanks Kevin for your suggestions.

When I came in this morning I made two (2) slight changes...Changed ReconciliationT to ReconciliationQ (Query) and Added Me.Requery. The change to ReconciliationQ was to filter the ReconciliationT by Statement Date. Now the  AfterUpdate Event is as follows:
Private Sub cbxClearFlag_AfterUpdate()
    '
    '      Clear/Unclear Selected Transaction
    '
    If IsNull(dtmStatementDate) = True Or IsNull(txtStatementBalance) = True Then
        MsgBox "Enter Statement Date and Balance", vbOKOnly + vbCritical, "Invalid Statement Date or Balance"
        Exit Sub
    End If
    DoCmd.SetWarnings False
    clearSql = "UPDATE ReconciliationQ SET ReconciliationQ.ClearFlag = """ & cbxClearFlag & """ WHERE TransID= """ & txtTransID & """"
    DoCmd.RunSQL clearSql
    clrTrans txtReconType
    DoCmd.SetWarnings True
    Me.Refresh
    
End Sub

Guess what...it works, however, now when the individual CheckBox is selected in the Detail Section of the form, All the unselected CheckBoxes are also  changed to correspond to the same value as the selected CheckBox. Note: the underlying table (ReconciliationT) is changed according to the selected CheckBox.

How to I prevent all the other CheckBoxes from changing.

Hope this makes sense.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/7/2026 12:58:16 AM. PLT: 0s