Avatar of Ralph Gould
Ralph GouldFlag for United States of America

asked on 

access/mysql write conflict error

using msaccess 2003 frontend to mysql 5 backend, remote xp users connect to hosted mysql site.
I'm getting a write conflict error when closing the primary form. The form is very complex with tons of subforms. I'm pretty sure that the forms are trying to write to the same place. What I'm looking for is a way to tell which of the subforms are involved without having to tear the form all apart. This is not my work so I don't have a good understanding of all of the code. Any thoughts greatly appreciated!
Microsoft AccessMySQL Server

Avatar of undefined
Last Comment
Ralph Gould
SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
SOLUTION
Avatar of MikeToole
MikeToole
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
Avatar of Rick_Rickards
Rick_Rickards
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Ralph Gould
Ralph Gould
Flag of United States of America image

ASKER

getting a little further. I have several previous versions of the app and they all exhibit the same problem. I have also learned that a number of datetime fields were added to the mysql backend. Checking that I find that there are a number of null datetime fields in the record, which I understand is a problem. So I'm leaning in this direction as my problem source. any comments appreciated.
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Yes, I have a comment.  Please post the code in question, OK?
Avatar of Ralph Gould
Ralph Gould
Flag of United States of America image

ASKER

Ray below is the code behind the "save and close" button on the form. note that this not a new record and the error occurs on the first requery statement.

code start
Private Sub cmdEditApptTrSaveAndClose_Click()
On Error GoTo Err_cmdEditApptTrSaveAndClose_Click
Dim theIDPrep As Long
Dim theAppTrIDPrep As Long
Dim theIDSetUp As Long
Dim theAppTrIDSetUp As Long
Dim theAppTimeSlotPr As Long
Dim adjAppTimeSlot As String

Forms!frmAppt_PopUp_Edit_ApptTr.Requery
   
'****************************************************************************************************************************
    If IsNull([JobStatusText]) Then
        MsgBox "Please choose a valid appointment status", vbDefaultButton1, "Data Entry Warning"
        Exit Sub
    End If
'****************************************************************************************************************************
    If [JobStatusText] = "Scheduled" And IsNull([AppDate]) Then
        MsgBox "Please provide an appointment date", vbDefaultButton1, "Data Entry Warning"
        Me.AppDate.SetFocus
        Exit Sub
    End If
'****************************************************************************************************************************
    If IsNull([AppTimeSlot]) And Me.JobStatusText = "Scheduled" Then
        MsgBox "Please provide a time slot", vbCritical, "Data Entry Warning"
        Exit Sub
    End If
'****************************************************************************************************************************
    If IsNull([AppDuration]) And Me.JobStatusText = "Scheduled" Then
        MsgBox "Please provide an appointment duration", vbCritical, "Data Entry Warning"
        Me.AppDuration.SetFocus
        Exit Sub
    End If
'****************************************************************************************************************************
    If [JobConfStatus] = "Confirmed" And IsNull([JobConfName]) Then
        MsgBox "Please provide a confirmation name", vbDefaultButton1, "Data Entry Warning"
        DoCmd.GoToControl "JobConfName"
        Exit Sub
    End If
'****************************************************************************************************************************
    If Not IsNull([ReschedReason]) And IsNull([WhyNotScheduled]) Then
        MsgBox "Please provide a cancellation comment", vbDefaultButton1, "Data Entry Warning"
        DoCmd.GoToControl "WhyNotScheduled"
        Exit Sub
    End If
'****************************************************************************************************************************
    If [SentStatus] = "Sent" And IsNull([SentDate]) Then
        MsgBox "Please provide an inspection report sent date", vbDefaultButton1, "Data Entry Warning"
        DoCmd.GoToControl "SentDate"
        Exit Sub
    End If
'****************************************************************************************************************************
   
    If Me.AppNew = "New" And Me.JobStatusText = "Scheduled" And Left(Me.AppType, 8) = "Training" Then
   
        Dim theResp As Long
       
            theResp = MsgBox("Would you like to auto-add the set-up and prep appointments?", vbYesNo, "Training Appointment")
   
                If theResp = 6 Then

                    theIDPrep = DMax("[AppID]", "tblAppt") + 1
                    theAppTrIDPrep = DMax("[AppTrackingID]", "tblAppt_Tracking") + 1
                    theAppTimeSlotPr = DLookup("[AppTimeSlotPr]", "qryApptDur_PrNbr") - 2
                    adjAppTimeSlot = DLookup("[AppTimeSlot]", "temp_Appt_Tracking_AppTimeSlot", "[AppTimeSlotPr] = " & theAppTimeSlotPr)
               
                    Me.AppNew = Null
                   
                        Set theSet = CurrentDb.OpenRecordset("tblAppt")
                        theSet.AddNew
                        theSet![LocID] = Forms![frmLoc].[LocID]
                        theSet![AppType] = "Training Prep"
                        theSet![EnteredBy] = DLookup("[UserID]", "temp_Users")
                        theSet![EnteredDate] = Date
                        theSet![EnteredTime] = Time
                        theSet![AppID] = theIDPrep
                        theSet.Update
                        theSet.Close
                       
                    Dim WkDayApp As Date
                   
                        WkDayApp = Switch(Weekday(Me.AppDate) = 3, DateAdd("d", Me.AppDate, -4), Weekday(Me.AppDate) = 4, DateAdd("d", Me.AppDate, -5), Weekday(Me.AppDate) = 2 Or Weekday(Me.AppDate) = 5 Or Weekday(Me.AppDate) = 6, DateAdd("d", Me.AppDate, -3))
                       
                        Set theSet2 = CurrentDb.OpenRecordset("tblAppt_Tracking")
                        theSet2.AddNew
                        theSet2![AppID] = theIDPrep
                        theSet2![JobStatusText] = "Scheduled"
                        theSet2![AppDate] = WkDayApp
                        theSet2![InspectorName] = Me.[InspectorName]
                        theSet2![AppTimeSlot] = "7:30a"
                        theSet2![AppDuration] = "1.0 Hr"
                        theSet2![IRTruckTrlr] = 0
                        theSet2![IRElec] = 0
                        theSet2![IRGenInd] = 0
                        theSet2![IRStorage] = 0
                        theSet2![IRExcav] = 0
                        theSet2![IRMaint] = 0
                        theSet2![IRMatStorage] = 0
                        theSet2![IRHvyEquip] = 0
                        theSet2![IRProtEquip] = 0
                        theSet2![IRConfSpace] = 0
                        theSet2![IRScaffolds] = 0
                        theSet2![IRLadders] = 0
                        theSet2![IRWkZone] = 0
                        theSet2![IRMisc] = 0
                        theSet2![IRFallProt] = 0
                        theSet2![IRFlam] = 0
                        theSet2![IRFireProt] = 0
                        theSet2![IRVeh] = 0
                        theSet2![IRTools] = 0
                        theSet2![IRHousekeeping] = 0
                        theSet2![IRFirstaid] = 0
                        theSet2![IRWelding] = 0
                        theSet2![GetQues] = 0
                        theSet2![ContactFirstName] = Forms![frmLoc].[FirstName]
                        theSet2![ContactLastName] = Forms![frmLoc].[LastName]
                        theSet2![ContactTitle] = Forms![frmLoc].[Title]
                        theSet2![AppTrackingID] = theAppTrIDPrep
                        theSet2.Update
                        theSet2.Close
                       
                    theIDPrep2 = DMax("[AppID]", "tblAppt") + 1
                    theAppTrIDPrep2 = DMax("[AppTrackingID]", "tblAppt_Tracking") + 1
                   
                        Set theSet3 = CurrentDb.OpenRecordset("tblAppt")
                        theSet3.AddNew
                        theSet3![LocID] = Forms![frmLoc].[LocID]
                        theSet3![AppType] = "Training Set Up"
                        theSet3![EnteredBy] = DLookup("[UserID]", "temp_Users")
                        theSet3![EnteredDate] = Date
                        theSet3![EnteredTime] = Time
                        theSet3![AppID] = theIDPrep2
                        theSet3.Update
                        theSet3.Close
                       
                        Set theSet4 = CurrentDb.OpenRecordset("tblAppt_Tracking")
                        theSet4.AddNew
                        theSet4![AppID] = theIDPrep2
                        theSet4![JobStatusText] = "Scheduled"
                        theSet4![AppDate] = Me.AppDate
                        theSet4![InspectorName] = Me.[InspectorName]
                        theSet4![AppTimeSlot] = adjAppTimeSlot
                        theSet4![AppDuration] = "1.0 Hr"
                        theSet4![IRTruckTrlr] = 0
                        theSet4![IRElec] = 0
                        theSet4![IRGenInd] = 0
                        theSet4![IRStorage] = 0
                        theSet4![IRExcav] = 0
                        theSet4![IRMaint] = 0
                        theSet4![IRMatStorage] = 0
                        theSet4![IRHvyEquip] = 0
                        theSet4![IRProtEquip] = 0
                        theSet4![IRConfSpace] = 0
                        theSet4![IRScaffolds] = 0
                        theSet4![IRLadders] = 0
                        theSet4![IRWkZone] = 0
                        theSet4![IRMisc] = 0
                        theSet4![IRFallProt] = 0
                        theSet4![IRFlam] = 0
                        theSet4![IRFireProt] = 0
                        theSet4![IRVeh] = 0
                        theSet4![IRTools] = 0
                        theSet4![IRHousekeeping] = 0
                        theSet4![IRFirstaid] = 0
                        theSet4![IRWelding] = 0
                        theSet4![GetQues] = 0
                        theSet4![ContactFirstName] = Forms![frmLoc].[FirstName]
                        theSet4![ContactLastName] = Forms![frmLoc].[LastName]
                        theSet4![ContactTitle] = Forms![frmLoc].[Title]
                        theSet4![AppTrackingID] = theAppTrIDPrep2
                        theSet4.Update
                        theSet4.Close
                       
                    End If
                   
                End If
               
    If Me.AppNew = "New" Then
        Me.AppNew = ""
    End If
   
    If IsOpen("frmLoc") Then
        Forms!frmLoc!frmLoc_Sub_ApptTr.Requery
    End If

    DoCmd.Close acForm, Me.Name, acSaveYes
 
Exit_cmdEditApptTrSaveAndClose_Click:
    Exit Sub

Err_cmdEditApptTrSaveAndClose_Click:
    MsgBox Err.Description
    Resume Exit_cmdEditApptTrSaveAndClose_Click
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Ralph Gould
Ralph Gould
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo