I am doing a multiple insert in vba access query as below:
Private Sub btnSubmit_Enter()
DoCmd.RunSQL ("insert into tblAutonumber (Dummy)values ('DummyValue')")
Dim lastAutonumber As Long
lastAutonumber = DMax("Autonumber", "tblAutonumber")
txtAutoNumber.Value = lastAutonumber
DoCmd.RunSQL ("insert into tbltesting " & _
"(Empid, TestScenario, testid, owner, event, version, " & _
"expresult, variation, status, homestore) values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtTestScenario.Value & "','" & _
Me.txtAutoNumber.Value & " ' ,'" & _
Me.txtOwner.Value & "','" & _
Me.txtEvent.Value & "', '" & _
Me.txtVersion.Value & "','" & _
Me.txtExpectedResult.Value & "', '" & _
Me.txtVariation.Value & "', '" & _
Me.txtStatus.Value & "','" & _
Me.txtHomeStore.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1," & _
"Start2, Finish2, Store2 ) values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Sunday ','" & _
Me.txtContSunStart1.Value & "', '" & _
Me.txtContSunFinish1.Value & "','" & _
Me.txtContSunStore1.Value & "','" & _
Me.txtContSunStart2.Value & "', '" & _
Me.txtContSunFinish2.Value & "','" & _
Me.txtContSunStore2.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1, " & _
"Start2, Finish2, Store2 ) values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Monday ','" & _
Me.txtContMonStart1.Value & "', '" & _
Me.txtContMonFinish1.Value & "','" & _
Me.txtContMonStore1.Value & "','" & _
Me.txtContMonStart2.Value & "', '" & _
Me.txtContMonFinish2.Value & "','" & _
Me.txtContMonStore2.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1," & _
"Start2, Finish2, Store2 ) values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Tuesday','" & _
Me.txtContTueStart1.Value & "', '" & _
Me.txtContTueFinish1.Value & "','" & _
Me.txtContTueStore1.Value & "','" & _
Me.txtContTueStart2.Value & "', '" & _
Me.txtContTueFinish2.Value & "','" & _
Me.txtContTueStore2.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1, " & _
"Start2, Finish2, Store2 ) values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Wednesday','" & _
Me.txtContWedStart1.Value & "', '" & _
Me.txtContWedFinish1.Value & "','" & _
Me.txtContWedStore1.Value & "','" & _
Me.txtContWedStart2.Value & "', '" & _
Me.txtContWedFinish2.Value & "','" & _
Me.txtContWedStore2.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1," & _
"Start2, Finish2, Store2 ) values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Thursday','" & _
Me.txtContThuStart1.Value & "', '" & _
Me.txtContThuFinish1.Value & "','" & _
Me.txtContThuStore1.Value & "','" & _
Me.txtContThuStart2.Value & "', '" & _
Me.txtContThuFinish2.Value & "','" & _
Me.txtContThuStore2.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1," & _
"Start2, Finish2, Store2 )values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Friday','" & _
Me.txtContFriStart1.Value & "', '" & _
Me.txtContFriFinish1.Value & "','" & _
Me.txtContFriStore1.Value & "','" & _
Me.txtContFriStart2.Value & "', '" & _
Me.txtContFriFinsh2.Value & "','" & _
Me.txtContFriStore2.Value & "')")
DoCmd.RunSQL ("insert into tblContract " & _
"(Empid, testid, Day, Start1, Finish1, Store1," & _
"Start2, Finish2, Store2 )values ('" & _
Me.txtEmpNo.Value & "','" & _
Me.txtAutoNumber.Value & "','Saturday','" & _
Me.txtContSatStart1.Value & "', '" & _
Me.txtContSatFinish1.Value & "','" & _
Me.txtContSatiStore1.Value & "','" & _
Me.txtContSatStart2.Value & "', '" & _
Me.txtContSatFinish2.Value & "','" & _
Me.txtContSatStore2.Value & "')")
End Sub
First two queries works fine (i.e. till Sunday)
But from Monday the execution breaks
I checked all variable in the query , there is not nulls there