UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
2 Pages V  1 2 >  (Go to first unread post)
   Reply to this topicStart new topic
> Resolving Write Conflict, Access 2016    
 
   
KarinG
post Oct 7 2019, 02:21 PM
Post#1



Posts: 25
Joined: 24-August 05



Hi everyone.

I am getting a write conflict message when I do a requery in my vba code. I would appreciate any help in figuring out how to stop the message or maybe even a better way to do what I am trying to do.

I have a bound tabbed form with 14 tabs. When the user presses a certain button it means they want to duplicate the record that they are currently on. I am using recordsets in the vba to clone the information with a new primary key. Once the records are duplicated I need to put a comment in the new record saying what the old primary key was and a comment in the old record saying what the new primary key is. Once that is done I want to go to the newly created record and open that in the form.

I added the following code as I was having problems opening the new record in the form. It now goes to the new record but I get the Write Conflict error message on the requery statement.
CODE
If Me.Dirty Then
       Me.Dirty = False
End If
Me.Requery

Does anyone have any ideas on how I would solve this problem?

Thanks for your help.

Karin
Go to the top of the page
 
theDBguy
post Oct 7 2019, 02:45 PM
Post#2


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi Karin. We might need more context than that. Can you post the entire code involved in the record duplication process? Thanks.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 7 2019, 02:58 PM
Post#3



Posts: 25
Joined: 24-August 05



Hi.
Here is the code I use for the first tab. I repeat this for all 14 tabs. The form and first tab are bound to tblVendorInfo.

CODE
        Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorInfo WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))
        Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorInfo WHERE 1=0")
        If Not rsSource.EOF Then
            rsTarget.AddNew                              
            rsTarget![VendorID] = strNewVendorNumber
            rsTarget![Status] = 3
            rsTarget![OperatingName] = rsSource![OperatingName]
            rsTarget![LegalName] = rsSource![LegalName]
            rsTarget![Address1] = rsSource![Address1]
            rsTarget![Address2] = rsSource![Address2]
            rsTarget![City] = rsSource![City]
            rsTarget![Prov] = rsSource![Prov]
            rsTarget![PostalCode] = rsSource![PostalCode]
            rsTarget![Phone] = rsSource![Phone]
            rsTarget![TollFree] = rsSource![TollFree]
            rsTarget![Fax] = rsSource![Fax]
            rsTarget![ContactName] = rsSource![ContactName]
            rsTarget![ContactPhone] = rsSource![ContactPhone]
            rsTarget![Ext] = rsSource![Ext]
            rsTarget![ContactCellNumber] = rsSource![ContactCellNumber]
            rsTarget![ContactFax] = rsSource![ContactFax]
            rsTarget![CorporateContact] = rsSource![CorporateContact]
            rsTarget![CorporateAddress1] = rsSource![CorporateAddress1]
            rsTarget![CorporateAddress2] = rsSource![CorporateAddress2]
            rsTarget![CorporateCity] = rsSource![CorporateCity]
            rsTarget![CorporateProv] = rsSource![CorporateProv]
            rsTarget![CorporatePostalCode] = rsSource![CorporatePostalCode]
            rsTarget![CorporatePhone] = rsSource![CorporatePhone]
            rsTarget![CorporateExt] = rsSource![CorporateExt]
            rsTarget![CorporateTollfree] = rsSource![CorporateTollfree]
            rsTarget![CorporateCell] = rsSource![CorporateCell]
            rsTarget![CorporateFax] = rsSource![CorporateFax]
            rsTarget![CorporateEmailAddress] = rsSource![CorporateEmailAddress]
            rsTarget![EmailAddress] = rsSource![EmailAddress]
            rsTarget![Comments] = rsSource![Comments]
            rsTarget.Update                              
            rsTarget.Close
            rsSource.Close
            Set rsSource = Nothing
            Set rsTarget = Nothing
        End If


Here is the code for the 14th tab.
CODE
        intCount = 1
        intCount = DCount("VendorID", "tblVendorSGCD", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorSGCD WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorSGCD WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![17] = rsSource![17]
                rsTarget![47] = rsSource![47]
                rsTarget![54] = rsSource![54]
                rsTarget![StartDate_SGCD] = rsSource![StartDate_SGCD]
                rsTarget![Comments_SGCD] = rsSource![Comments_SGCD]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If
Go to the top of the page
 
theDBguy
post Oct 7 2019, 03:08 PM
Post#4


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi. Thanks! Which part of that is giving your the error? Are you saying the user clicks one button, and you have to copy each of the 14 tab's data? If so, there may be a better way.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 7 2019, 03:21 PM
Post#5



Posts: 25
Joined: 24-August 05



Yes, you are correct. The user pushes one button and I have to duplicate all 14 tabs. I get the error on the requery which I do right after duplicating all the tabs.
Go to the top of the page
 
theDBguy
post Oct 7 2019, 03:29 PM
Post#6


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi Karin. What happens if you remove the If Me.Dirty part and just simply do the Me.Requery one?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 7 2019, 03:37 PM
Post#7



Posts: 25
Joined: 24-August 05



I still get the write conflict. That is why I added the me.dirty, but it didn't help. frown.gif
Go to the top of the page
 
theDBguy
post Oct 7 2019, 04:02 PM
Post#8


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


What is the code behind the button the user clicks?

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 7 2019, 04:12 PM
Post#9



Posts: 25
Joined: 24-August 05



Everything I showed you above plus a blurb at the beginning to create a new primary key. Do you want me to post the entire subroutine? It is pretty big as it includes all 14 tabs.
Go to the top of the page
 
theDBguy
post Oct 7 2019, 04:19 PM
Post#10


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi. Can you post a copy of the db instead? I'd like to see the beginning of the code including the headers. For example:
CODE
Private Sub ButtonName_Click()
blah blah blah...

End Sub

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 8 2019, 09:21 AM
Post#11



Posts: 25
Joined: 24-August 05



Here is the entire subroutine. I am not sure how to post the entire db. Oh - I see the attach file area now - is that what you want?
CODE
Private Sub optCOOOld_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim strYesNo As String
    Dim strOldVendorNumber As String
    Dim strNewVendorNumber As String
    Dim intSaveStatus As Integer
    Dim intCount As Integer
    Dim strSQL As String
    Dim intRandomNumber As Long
    Dim rsSource As dao.Recordset
    Dim rsTarget As dao.Recordset
    intCount = 1
    intSaveStatus = Forms![frmVendorMain]![optGroupStatus]
    strYesNo = MsgBox("Do you want to do a Change of Ownership for this vendor?", vbYesNo, "Change Of Ownership")
    If strYesNo = vbYes Then
        strOldVendorNumber = Forms![frmVendorMain]![txtVendorID]
        strNewVendorNumber = InputBox("Please enter the new vendor number - If no number is entered a randon number will be generated", "New Vendor Number")
        If strNewVendorNumber = "" Then
            Do While intCount > 0
                Randomize
                intRandomNumber = Int((1000000 - 100000 + 1) * Rnd + 100000)
                strNewVendorNumber = "TBD" & intRandomNumber
                intCount = DCount("[VendorIDNew]", "tblVendorCOO", "VendorIDNew= " & Chr(34) & strNewVendorNumber & Chr(34))
            Loop
        Else
            intCount = DCount("[VendorID]", "tblVendorInfo", "VendorID= " & Chr(34) & strNewVendorNumber & Chr(34))
            Do While intCount > 0
                strNewVendorNumber = InputBox("Vendor Number already exists. Please enter the new vendor number.", "New Vendor Number")
                intCount = DCount("[VendorID]", "tblVendorInfo", "VendorID= " & Chr(34) & strNewVendorNumber & Chr(34))
            Loop
        End If
'        Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorCOO WHERE 1=0")
        Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorCOO")
        If Not rsTarget.EOF Then
            rsTarget.AddNew                               ' Append a new record to destination table
            rsTarget![VendorIDNew] = strNewVendorNumber
            rsTarget![VendorIDOld] = strOldVendorNumber
            rsTarget.Update
            rsTarget.Close
            Set rsTarget = Nothing
        End If

        If Left(strNewVendorNumber, 3) = "TBD" Then
                If Forms![frmVendorMain]![frmVendorInfo]![txtComments] = "" Or IsNull(Forms![frmVendorMain]![frmVendorInfo]![txtComments]) Then
                    Forms![frmVendorMain]![frmVendorInfo]![txtComments] = Format(Date, "yyyy/mm/dd") & " - The new temporary vendor number is " & strNewVendorNumber & "."
                Else
                    Forms![frmVendorMain]![frmVendorInfo]![txtComments] = Forms![frmVendorMain]![frmVendorInfo]![txtComments] & vbCrLf & Format(Date, "yyyy/mm/dd") & " - The new temporary vendor number is " & strNewVendorNumber & "."
                End If
        Else
                If Forms![frmVendorMain]![frmVendorInfo]![txtComments] = "" Or IsNull(Forms![frmVendorMain]![frmVendorInfo]![txtComments]) Then
                    Forms![frmVendorMain]![frmVendorInfo]![txtComments] = Format(Date, "yyyy/mm/dd") & " - The new vendor number is " & strNewVendorNumber & "."
                Else
                    Forms![frmVendorMain]![frmVendorInfo]![txtComments] = Forms![frmVendorMain]![frmVendorInfo]![txtComments] & vbCrLf & Format(Date, "yyyy/mm/dd") & " - The new vendor number is " & strNewVendorNumber & "."
                End If
        End If
        Forms![frmVendorMain]![optGroupStatus] = 2
        DoCmd.Save

        ' duplicate the main information
        Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorInfo WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
        Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorInfo WHERE 1=0") ' Open Target Table
        If Not rsSource.EOF Then
            rsTarget.AddNew                               ' Append a new record to destination table
            rsTarget![VendorID] = strNewVendorNumber
            rsTarget![Status] = 3
            rsTarget![OperatingName] = rsSource![OperatingName]
            rsTarget![LegalName] = rsSource![LegalName]
            rsTarget![Address1] = rsSource![Address1]
            rsTarget![Address2] = rsSource![Address2]
            rsTarget![City] = rsSource![City]
            rsTarget![Prov] = rsSource![Prov]
            rsTarget![PostalCode] = rsSource![PostalCode]
            rsTarget![Phone] = rsSource![Phone]
            rsTarget![TollFree] = rsSource![TollFree]
            rsTarget![Fax] = rsSource![Fax]
            rsTarget![ContactName] = rsSource![ContactName]
            rsTarget![ContactPhone] = rsSource![ContactPhone]
            rsTarget![Ext] = rsSource![Ext]
            rsTarget![ContactCellNumber] = rsSource![ContactCellNumber]
            rsTarget![ContactFax] = rsSource![ContactFax]
            rsTarget![CorporateContact] = rsSource![CorporateContact]
            rsTarget![CorporateAddress1] = rsSource![CorporateAddress1]
            rsTarget![CorporateAddress2] = rsSource![CorporateAddress2]
            rsTarget![CorporateCity] = rsSource![CorporateCity]
            rsTarget![CorporateProv] = rsSource![CorporateProv]
            rsTarget![CorporatePostalCode] = rsSource![CorporatePostalCode]
            rsTarget![CorporatePhone] = rsSource![CorporatePhone]
            rsTarget![CorporateExt] = rsSource![CorporateExt]
            rsTarget![CorporateTollfree] = rsSource![CorporateTollfree]
            rsTarget![CorporateCell] = rsSource![CorporateCell]
            rsTarget![CorporateFax] = rsSource![CorporateFax]
            rsTarget![CorporateEmailAddress] = rsSource![CorporateEmailAddress]
            rsTarget![EmailAddress] = rsSource![EmailAddress]
            rsTarget![Comments] = rsSource![Comments]
            rsTarget.Update                               ' Save new record
            rsTarget.Close
            rsSource.Close
            Set rsSource = Nothing
            Set rsTarget = Nothing
        End If

        'search MEDSURG table for vendor id - if found clone it
        intCount = DCount("*", "tblVendorMedSurg", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorMedSurg WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorMedSurg WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![29] = rsSource![29]
                rsTarget![30] = rsSource![30]
                rsTarget![31] = rsSource![31]
                rsTarget![32] = rsSource![32]
                rsTarget![33] = rsSource![33]
                rsTarget![34] = rsSource![34]
                rsTarget![35] = rsSource![35]
                rsTarget![36] = rsSource![36]
                rsTarget![37] = rsSource![37]
                rsTarget![Vendor_MedSurg] = rsSource![Vendor_MedSurg]
                rsTarget![Title_MedSurg] = rsSource![Title_MedSurg]
                rsTarget![CheckSent_MedSurg] = rsSource![CheckSent_MedSurg]
                rsTarget![CheckRec_MedSurg] = rsSource![CheckRec_MedSurg]
                rsTarget![PMReview_MedSurg] = rsSource![PMReview_MedSurg]
                rsTarget![Complete_MedSurg] = rsSource![Complete_MedSurg]
                rsTarget![AgrSent_MedSurg] = rsSource![AgrSent_MedSurg]
                rsTarget![AgrRec_MedSurg] = rsSource![AgrRec_MedSurg]
                rsTarget![AHSig_MedSurg] = rsSource![AHSig_MedSurg]
                rsTarget![Done_MedSurg] = rsSource![Done_MedSurg]
                rsTarget![AgreementStartDate_MedSurg] = rsSource![AgreementStartDate_MedSurg]
                rsTarget![AgreementEndDate_MedSurg] = rsSource![AgreementEndDate_MedSurg]
                rsTarget![Amendment#1StartDate_MedSurg] = rsSource![Amendment#1StartDate_MedSurg]
                rsTarget![BenefitCode#1_MedSurg] = rsSource![BenefitCode#1_MedSurg]
                rsTarget![Amend#1Sent_MedSurg] = rsSource![Amend#1Sent_MedSurg]
                rsTarget![Amend#1Rec_MedSurg] = rsSource![Amend#1Rec_MedSurg]
                rsTarget![Amend#1AHSig_MedSurg] = rsSource![Amend#1AHSig_MedSurg]
                rsTarget![Amend#1Done_MedSurg] = rsSource![Amend#1Done_MedSurg]
                rsTarget![Amendment#2StartDate_MedSurg] = rsSource![Amendment#2StartDate_MedSurg]
                rsTarget![BenefitCode#2_MedSurg] = rsSource![BenefitCode#2_MedSurg]
                rsTarget![Amend#2Sent_MedSurg] = rsSource![Amend#2Sent_MedSurg]
                rsTarget![Amend#2Rec_MedSurg] = rsSource![Amend#2Rec_MedSurg]
                rsTarget![Amend#2AHSig_MedSurg] = rsSource![Amend#2AHSig_MedSurg]
                rsTarget![Amend#2Done_MedSurg] = rsSource![Amend#2Done_MedSurg]
                rsTarget![Amendment#3StartDate_MedSurg] = rsSource![Amendment#3StartDate_MedSurg]
                rsTarget![BenefitCode#3_MedSurg] = rsSource![BenefitCode#3_MedSurg]
                rsTarget![Amend#3Sent_MedSurg] = rsSource![Amend#3Sent_MedSurg]
                rsTarget![Amend#3Rec_MedSurg] = rsSource![Amend#3Rec_MedSurg]
                rsTarget![Amend#3AHSig_MedSurg] = rsSource![Amend#3AHSig_MedSurg]
                rsTarget![Amend#3Done_MedSurg] = rsSource![Amend#3Done_MedSurg]
                rsTarget![Comments_MedSurg] = rsSource![Comments_MedSurg]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

        'search MOBEQ table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorMobilityEq", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorMobilityEq WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorMobilityEq WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![16A] = rsSource![16A]
                rsTarget![39] = rsSource![39]
                rsTarget![39A] = rsSource![39A]
                rsTarget![40] = rsSource![40]
                rsTarget![42] = rsSource![42]
                rsTarget![43A] = rsSource![43A]
                rsTarget![58] = rsSource![58]
                rsTarget![Vendor_MobilityEq] = rsSource![Vendor_MobilityEq]
                rsTarget![Title_MobilityEq] = rsSource![Title_MobilityEq]
                rsTarget![CheckSent_MobilityEq] = rsSource![CheckSent_MobilityEq]
                rsTarget![CheckRec_MobilityEq] = rsSource![CheckRec_MobilityEq]
                rsTarget![PMReview_MobilityEq] = rsSource![PMReview_MobilityEq]
                rsTarget![Complete_MobilityEq] = rsSource![Complete_MobilityEq]
                rsTarget![AgrSent_MobilityEq] = rsSource![AgrSent_MobilityEq]
                rsTarget![AgrRec_MobilityEq] = rsSource![AgrRec_MobilityEq]
                rsTarget![AHSig_MobilityEq] = rsSource![AHSig_MobilityEq]
                rsTarget![Done_MobilityEq] = rsSource![Done_MobilityEq]
                rsTarget![AgreementStartDate_MobilityEq] = rsSource![AgreementStartDate_MobilityEq]
                rsTarget![AgreementEndDate_MobilityEq] = rsSource![AgreementEndDate_MobilityEq]
                rsTarget![Amendment#1StartDate_MobilityEq] = rsSource![Amendment#1StartDate_MobilityEq]
                rsTarget![BenefitCode#1_MobilityEq] = rsSource![BenefitCode#1_MobilityEq]
                rsTarget![Amend#1Sent_MobilityEq] = rsSource![Amend#1Sent_MobilityEq]
                rsTarget![Amend#1Rec_MobilityEq] = rsSource![Amend#1Rec_MobilityEq]
                rsTarget![Amend#1AHSig_MobilityEq] = rsSource![Amend#1AHSig_MobilityEq]
                rsTarget![Amend#1Done_MobilityEq] = rsSource![Amend#1Done_MobilityEq]
                rsTarget![Amendment#2StartDate_MobilityEq] = rsSource![Amendment#2StartDate_MobilityEq]
                rsTarget![BenefitCode#2_MobilityEq] = rsSource![BenefitCode#2_MobilityEq]
                rsTarget![Amend#2Sent_MobilityEq] = rsSource![Amend#2Sent_MobilityEq]
                rsTarget![Amend#2Rec_MobilityEq] = rsSource![Amend#2Rec_MobilityEq]
                rsTarget![Amend#2AHSig_MobilityEq] = rsSource![Amend#2AHSig_MobilityEq]
                rsTarget![Amend#2Done_MobilityEq] = rsSource![Amend#2Done_MobilityEq]
                rsTarget![Amendment#3StartDate_MobilityEq] = rsSource![Amendment#3StartDate_MobilityEq]
                rsTarget![BenefitCode#3_MobilityEq] = rsSource![BenefitCode#3_MobilityEq]
                rsTarget![Amend#3Sent_MobilityEq] = rsSource![Amend#3Sent_MobilityEq]
                rsTarget![Amend#3Rec_MobilityEq] = rsSource![Amend#3Rec_MobilityEq]
                rsTarget![Amend#3AHSig_MobilityEq] = rsSource![Amend#3AHSig_MobilityEq]
                rsTarget![Amend#3Done_MobilityEq] = rsSource![Amend#3Done_MobilityEq]
                rsTarget![Comments_MobilityEq] = rsSource![Comments_MobilityEq]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

       'search HEARING table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorHearing", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorHearing WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorHearing WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![05] = rsSource![05]
                rsTarget![06] = rsSource![06]
                rsTarget![Vendor_Hearing] = rsSource![Vendor_Hearing]
                rsTarget![Title_Hearing] = rsSource![Title_Hearing]
                rsTarget![CheckSent_Hearing] = rsSource![CheckSent_Hearing]
                rsTarget![CheckRec_Hearing] = rsSource![CheckRec_Hearing]
                rsTarget![PMReview_Hearing] = rsSource![PMReview_Hearing]
                rsTarget![Complete_Hearing] = rsSource![Complete_Hearing]
                rsTarget![AgrSent_Hearing] = rsSource![AgrSent_Hearing]
                rsTarget![AgrRec_Hearing] = rsSource![AgrRec_Hearing]
                rsTarget![AHSig_Hearing] = rsSource![AHSig_Hearing]
                rsTarget![Done_Hearing] = rsSource![Done_Hearing]
                rsTarget![AgreementStartDate_Hearing] = rsSource![AgreementStartDate_Hearing]
                rsTarget![AgreementEndDate_Hearing] = rsSource![AgreementEndDate_Hearing]
                rsTarget![Comments_Hearing] = rsSource![Comments_Hearing]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

         'search MASTECTOMY table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorMastectomy", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorMastectomy WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorMastectomy WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![38] = rsSource![38]
                rsTarget![Vendor_Mastectomy] = rsSource![Vendor_Mastectomy]
                rsTarget![Title_Mastectomy] = rsSource![Title_Mastectomy]
                rsTarget![CheckSent_Mastectomy] = rsSource![CheckSent_Mastectomy]
                rsTarget![CheckRec_Mastectomy] = rsSource![CheckRec_Mastectomy]
                rsTarget![PMReview_Mastectomy] = rsSource![PMReview_Mastectomy]
                rsTarget![Complete_Mastectomy] = rsSource![Complete_Mastectomy]
                rsTarget![AgrSent_Mastectomy] = rsSource![AgrSent_Mastectomy]
                rsTarget![AgrRec_Mastectomy] = rsSource![AgrRec_Mastectomy]
                rsTarget![AHSig_Mastectomy] = rsSource![AHSig_Mastectomy]
                rsTarget![Done_Mastectomy] = rsSource![Done_Mastectomy]
                rsTarget![AgreementStartDate_Mastectomy] = rsSource![AgreementStartDate_Mastectomy]
                rsTarget![AgreementEndDate_Mastectomy] = rsSource![AgreementEndDate_Mastectomy]
                rsTarget![Comments_Mastectomy] = rsSource![Comments_Mastectomy]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

         'search P&O table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorPO", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorPO WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorPO WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![07] = rsSource![07]
                rsTarget![08] = rsSource![08]
                rsTarget![Vendor_PO] = rsSource![Vendor_PO]
                rsTarget![Title_PO] = rsSource![Title_PO]
                rsTarget![CheckSent_PO] = rsSource![CheckSent_PO]
                rsTarget![CheckRec_PO] = rsSource![CheckRec_PO]
                rsTarget![PMReview_PO] = rsSource![PMReview_PO]
                rsTarget![Complete_PO] = rsSource![Complete_PO]
                rsTarget![AgrSent_PO] = rsSource![AgrSent_PO]
                rsTarget![AgrRec_PO] = rsSource![AgrRec_PO]
                rsTarget![AHSig_PO] = rsSource![AHSig_PO]
                rsTarget![Done_PO] = rsSource![Done_PO]
                rsTarget![AgreementStartDate_PO] = rsSource![AgreementStartDate_PO]
                rsTarget![AgreementEndDate_PO] = rsSource![AgreementEndDate_PO]
                rsTarget![Comments_PO] = rsSource![Comments_PO]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

        'search ARTIFICIAL EYES table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorArtificialEyes", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorArtificialEyes WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblvendorArtificialEyes WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![09] = rsSource![09]
                rsTarget![Vendor_ArtificialEyes] = rsSource![Vendor_ArtificialEyes]
                rsTarget![Title_ArtificialEyes] = rsSource![Title_ArtificialEyes]
                rsTarget![AgreementStartDate_ArtificialEyes] = rsSource![AgreementStartDate_ArtificialEyes]
                rsTarget![AgreementEndDate_ArtificialEyes] = rsSource![AgreementEndDate_ArtificialEyes]
                rsTarget![Comments_ArtificialEyes] = rsSource![Comments_ArtificialEyes]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

         'search CM FOOTWEAR table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorCMFootwear", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorCMFootwear WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorCMFootwear WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![10] = rsSource![10]
                rsTarget![Vendor_CMFootwear] = rsSource![Vendor_CMFootwear]
                rsTarget![Title_CMFootwear] = rsSource![Title_CMFootwear]
                rsTarget![CheckSent_CMFootwear] = rsSource![CheckSent_CMFootwear]
                rsTarget![CheckRec_CMFootwear] = rsSource![CheckRec_CMFootwear]
                rsTarget![PMReview_CMFootwear] = rsSource![PMReview_CMFootwear]
                rsTarget![Complete_CMFootwear] = rsSource![Complete_CMFootwear]
                rsTarget![AgrSent_CMFootwear] = rsSource![AgrSent_CMFootwear]
                rsTarget![AgrRec_CMFootwear] = rsSource![AgrRec_CMFootwear]
                rsTarget![AHSig_CMFootwear] = rsSource![AHSig_CMFootwear]
                rsTarget![Done_CMFootwear] = rsSource![Done_CMFootwear]
                rsTarget![AgreementStartDate_CMFootwear] = rsSource![AgreementStartDate_CMFootwear]
                rsTarget![AgreementEndDate_CMFootwear] = rsSource![AgreementEndDate_CMFootwear]
                rsTarget![Comments_CMFootwear] = rsSource![Comments_CMFootwear]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

         'search SHOE ELEVATIONS table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorShoeElevations", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorShoeElevations WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorShoeElevations WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![51] = rsSource![51]
                rsTarget![Vendor_ShoeElevations] = rsSource![Vendor_ShoeElevations]
                rsTarget![Title_ShoeElevations] = rsSource![Title_ShoeElevations]
                rsTarget![CheckSent_ShoeElevations] = rsSource![CheckSent_ShoeElevations]
                rsTarget![CheckRec_ShoeElevations] = rsSource![CheckRec_ShoeElevations]
                rsTarget![PMReview_ShoeElevations] = rsSource![PMReview_ShoeElevations]
                rsTarget![Complete_ShoeElevations] = rsSource![Complete_ShoeElevations]
                rsTarget![AgrSent_ShoeElevations] = rsSource![AgrSent_ShoeElevations]
                rsTarget![AgrRec_ShoeElevations] = rsSource![AgrRec_ShoeElevations]
                rsTarget![AHSig_ShoeElevations] = rsSource![AHSig_ShoeElevations]
                rsTarget![Done_ShoeElevations] = rsSource![Done_ShoeElevations]
                rsTarget![AgreementStartDate_ShoeElevations] = rsSource![AgreementStartDate_ShoeElevations]
                rsTarget![AgreementEndDate_ShoeElevations] = rsSource![AgreementEndDate_ShoeElevations]
                rsTarget![Comments_ShoeElevations] = rsSource![Comments_ShoeElevations]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

         'search THERAPEUTIC SHOES table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorTherapeuticShoes", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorTherapeuticShoes WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorTherapeuticShoes WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![53] = rsSource![53]
                rsTarget![55] = rsSource![55]
                rsTarget![57] = rsSource![57]
                rsTarget![Vendor_TherapeuticShoes] = rsSource![Vendor_TherapeuticShoes]
                rsTarget![Title_TherapeuticShoes] = rsSource![Title_TherapeuticShoes]
                rsTarget![CheckSent_TherapeuticShoes] = rsSource![CheckSent_TherapeuticShoes]
                rsTarget![CheckRec_TherapeuticShoes] = rsSource![CheckRec_TherapeuticShoes]
                rsTarget![PMReview_TherapeuticShoes] = rsSource![PMReview_TherapeuticShoes]
                rsTarget![Complete_TherapeuticShoes] = rsSource![Complete_TherapeuticShoes]
                rsTarget![AgrSent_TherapeuticShoes] = rsSource![AgrSent_TherapeuticShoes]
                rsTarget![AgrRec_TherapeuticShoes] = rsSource![AgrRec_TherapeuticShoes]
                rsTarget![AHSig_TherapeuticShoes] = rsSource![AHSig_TherapeuticShoes]
                rsTarget![Done_TherapeuticShoes] = rsSource![Done_TherapeuticShoes]
                rsTarget![AgreementStartDate_TherapeuticShoes] = rsSource![AgreementStartDate_TherapeuticShoes]
                rsTarget![AgreementEndDate_TherapeuticShoes] = rsSource![AgreementEndDate_TherapeuticShoes]
                rsTarget![Comments_TherapeuticShoes] = rsSource![Comments_TherapeuticShoes]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

        'search RESPIRATORY tables for vendor id - if found clone it
        intCount = DCount("VendorID", "tblVendorRespiratory", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorRespiratory WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorRespiratory WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![14] = rsSource![14]
                rsTarget![14A] = rsSource![14A]
                rsTarget![59] = rsSource![59]
                rsTarget![Vendor_Respiratory] = rsSource![Vendor_Respiratory]
                rsTarget![Title_Respiratory] = rsSource![Title_Respiratory]
                rsTarget![CheckSent_Respiratory] = rsSource![CheckSent_Respiratory]
                rsTarget![CheckRec_Respiratory] = rsSource![CheckRec_Respiratory]
                rsTarget![PMReview_Respiratory] = rsSource![PMReview_Respiratory]
                rsTarget![Complete_Respiratory] = rsSource![Complete_Respiratory]
                rsTarget![AgrSent_Respiratory] = rsSource![AgrSent_Respiratory]
                rsTarget![AgrRec_Respiratory] = rsSource![AgrRec_Respiratory]
                rsTarget![AHSig_Respiratory] = rsSource![AHSig_Respiratory]
                rsTarget![Done_Respiratory] = rsSource![Done_Respiratory]
                rsTarget![AgreementStartDate_Respiratory] = rsSource![AgreementStartDate_Respiratory]
                rsTarget![AgreementEndDate_Respiratory] = rsSource![AgreementEndDate_Respiratory]
                rsTarget![Amendment#1StartDate_Respiratory] = rsSource![Amendment#1StartDate_Respiratory]
                rsTarget![BenefitCode#1_Respiratory] = rsSource![BenefitCode#1_Respiratory]
                rsTarget![Amend#1Sent_Respiratory] = rsSource![Amend#1Sent_Respiratory]
                rsTarget![Amend#1Rec_Respiratory] = rsSource![Amend#1Rec_Respiratory]
                rsTarget![Amend#1AHSig_Respiratory] = rsSource![Amend#1AHSig_Respiratory]
                rsTarget![Amend#1Done_Respiratory] = rsSource![Amend#1Done_Respiratory]
                rsTarget![Comments_Respiratory] = rsSource![Comments_Respiratory]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

        'search SEATING tables for vendor id - if found clone it
        intCount = DCount("VendorID", "tblVendorSeating", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorSeating WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorSeating WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![41] = rsSource![41]
                rsTarget![61 Com] = rsSource![61 Com]
                rsTarget![61 Cus] = rsSource![61 Cus]
                rsTarget![62 Com] = rsSource![62 Com]
                rsTarget![62 Cus] = rsSource![62 Cus]
                rsTarget![Vendor_Seating] = rsSource![Vendor_Seating]
                rsTarget![Title_Seating] = rsSource![Title_Seating]
                rsTarget![CheckSent_Seating] = rsSource![CheckSent_Seating]
                rsTarget![CheckRec_Seating] = rsSource![CheckRec_Seating]
                rsTarget![PMReview_Seating] = rsSource![PMReview_Seating]
                rsTarget![Complete_Seating] = rsSource![Complete_Seating]
                rsTarget![AgrSent_Seating] = rsSource![AgrSent_Seating]
                rsTarget![AgrRec_Seating] = rsSource![AgrRec_Seating]
                rsTarget![AHSig_Seating] = rsSource![AHSig_Seating]
                rsTarget![Done_Seating] = rsSource![Done_Seating]
                rsTarget![AgreementStartDate_Seating] = rsSource![AgreementStartDate_Seating]
                rsTarget![AgreementEndDate_Seating] = rsSource![AgreementEndDate_Seating]
                rsTarget![Amendment#1StartDate_Seating] = rsSource![Amendment#1StartDate_Seating]
                rsTarget![BenefitCode#1_Seating] = rsSource![BenefitCode#1_Seating]
                rsTarget![Amend#1Sent_Seating] = rsSource![Amend#1Sent_Seating]
                rsTarget![Amend#1Rec_Seating] = rsSource![Amend#1Rec_Seating]
                rsTarget![Amend#1AHSig_Seating] = rsSource![Amend#1AHSig_Seating]
                rsTarget![Amend#1Done_Seating] = rsSource![Amend#1Done_Seating]
                rsTarget![Comments_Seating] = rsSource![Comments_Seating]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

         'search WC AND LE table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorWCandLE", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorWCandLE WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorWCandLE WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![12] = rsSource![12]
                rsTarget![16] = rsSource![16]
                rsTarget![43] = rsSource![43]
                rsTarget![44] = rsSource![44]
                rsTarget![45] = rsSource![45]
                rsTarget![Comments_WCandLE] = rsSource![Comments_WCandLE]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If

        'search SGCD table for vendor id - if found clone it
        intCount = 1
        intCount = DCount("VendorID", "tblVendorSGCD", "VendorID= " & Chr(34) & strOldVendorNumber & Chr(34))
        If intCount > 0 Then
            Set rsSource = CurrentDb.OpenRecordset("SELECT * FROM tblVendorSGCD WHERE [VendorID] = " & Chr(34) & strOldVendorNumber & Chr(34))  ' Open Source Table
            Set rsTarget = CurrentDb.OpenRecordset("SELECT * FROM tblVendorSGCD WHERE 1=0") ' Open Target Table
            If Not rsSource.EOF Then
                rsTarget.AddNew                               ' Append a new record to destination table
                rsTarget![VendorID] = strNewVendorNumber
                rsTarget![17] = rsSource![17]
                rsTarget![47] = rsSource![47]
                rsTarget![54] = rsSource![54]
                rsTarget![StartDate_SGCD] = rsSource![StartDate_SGCD]
                rsTarget![Comments_SGCD] = rsSource![Comments_SGCD]
                rsTarget.Update                               ' Save new record
                rsTarget.Close
                rsSource.Close
                Set rsSource = Nothing
                Set rsTarget = Nothing
            End If
        End If
        
        ' show new record on form
    Me.Requery    'THIS IS CAUSING THE WRITE CONFLICT ERROR
    Dim rst As Recordset
    Set rst = Me.RecordsetClone
    rst.FindFirst "[VendorID] = '" & strNewVendorNumber & "'"
    If rst.NoMatch Then
        MsgBox "Grrr"
    Else
        Me.Bookmark = rst.Bookmark
    End If
    
    
    
        If Forms![frmVendorMain]![frmVendorInfo]![txtComments] = "" Or IsNull(Forms![frmVendorMain]![frmVendorInfo]![txtComments]) Then
            Forms![frmVendorMain]![frmVendorInfo]![txtComments] = Format(Date, "yyyy/mm/dd") & " - The old vendor number is " & strOldVendorNumber & "."
        Else
            Forms![frmVendorMain]![frmVendorInfo]![txtComments] = Forms![frmVendorMain]![frmVendorInfo]![txtComments] & vbCrLf & Format(Date, "yyyy/mm/dd") & " - The old vendor number is " & strOldVendorNumber & "."
        End If
      
        DoCmd.Save
'        If Me.Dirty Then
'            Me.Dirty = False
'        End If
        MsgBox "Done"
    Else
        Forms![frmVendorMain]![optGroupStatus] = intSaveStatus
        DoCmd.Save
    End If
End Sub

Go to the top of the page
 
theDBguy
post Oct 8 2019, 10:03 AM
Post#12


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi Karin. I'll take a look at your code in a minute. I just have a quick question first. Here's the first part of your code:
CODE
Private Sub optCOOOld_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

Is "optCOOOld" the name of your button? Just checking...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
theDBguy
post Oct 8 2019, 10:07 AM
Post#13


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Okay. One more thing... You have DoCmd.Save several times in your code, and I'm not sure what you were expecting to happen with them. Can you explain their use? Thanks.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 8 2019, 11:11 AM
Post#14



Posts: 25
Joined: 24-August 05



Yes, optCOOOld is the name of the button. I put in several DoCmd.Save's hoping that by saving the form data it would solve the write conflict message.
Go to the top of the page
 
theDBguy
post Oct 8 2019, 12:04 PM
Post#15


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


Hi. Okay, that's what I thought you were thinking; but unfortunately, that's not what's happening. DoCmd.Save does not save data, it saves objects, like your form design, in this case.

Okay, one quick thing to try before I ask for a demo file. Try moving the Me.Dirty code all the way to the top of the code. In other words, before you do anything else in the code, have it do the Dirty=False part. If this doesn't help, see if you can post a copy of your db, so we can walk through the code one line at a time during execution.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 8 2019, 01:17 PM
Post#16



Posts: 25
Joined: 24-August 05



Unfortunately that didn't help. I am working on decreasing the size of the database so that I can attach it.
Thank you for all your help!

I can't get it below 3.5 MB. Is there a trick to getting it below 2MB?!?
This post has been edited by KarinG: Oct 8 2019, 01:24 PM
Go to the top of the page
 
theDBguy
post Oct 8 2019, 01:37 PM
Post#17


UA Moderator
Posts: 76,911
Joined: 19-June 07
From: SunnySandyEggo


See if this helps...

1. Export only the necessary objects to a new blank database
2. Do a Compact & Repair
3. Zip up (or compress) the file

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Access Website | Access Blog | Email
Go to the top of the page
 
KarinG
post Oct 8 2019, 01:45 PM
Post#18



Posts: 25
Joined: 24-August 05



Sorry about that. It would help if I read the instructions first. frown.gif
I have attached the database now. I used 7-Zip.

Attached File  Vendors___Demo.zip ( 575.01K )Number of downloads: 4


I guess it would help if I attached the backend too. doh.gif

Attached File  Vendors_be___Demo.zip ( 542.38K )Number of downloads: 6

This post has been edited by KarinG: Oct 8 2019, 02:25 PM
Go to the top of the page
 
isladogs
post Oct 8 2019, 02:35 PM
Post#19


UtterAccess VIP
Posts: 1,925
Joined: 4-June 18
From: Somerset, UK


Hi Karin
Apologies. I haven't looked at your lengthy code nor your uploaded files.
Write conflict errors can be difficult to pin down.
Usually these are caused by two different database objects trying to update the same data simultaneously.
For example 2 forms open in edit mode which both have a record source based on the same table.

However this can also occur for more obscure reasons such as updating linked SQL server tables containing bit fields where no default value was set and with one or more null values (not allowed in Access).

The latter would appear to be irrelevant in your case. Does anything like the first suggestion seem possible?
If so ensure only one of the forms is open.

--------------------
Colin (Mendip Data Systems)
Website, email
Go to the top of the page
 
KarinG
post Oct 8 2019, 03:09 PM
Post#20



Posts: 25
Joined: 24-August 05



There is only one form open. I assume the error is happening because I am updating the form (adding text to the comment field) and also adding a new record to the same table (in the same subroutine). They are different records but the same table. Is there some way to tell it to save the data on the form so that I can add new records?
Karin
Go to the top of the page
 
2 Pages V  1 2 >


Custom Search


RSSSearch   Top   Lo-Fi    16th December 2019 - 01:15 AM