Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple insert problem
    primarykey
    data
    text
    <p>I am doing a multiple insert in vba access query as below:</p> <pre><code>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 " &amp; _ "(Empid, TestScenario, testid, owner, event, version, " &amp; _ "expresult, variation, status, homestore) values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtTestScenario.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; " ' ,'" &amp; _ Me.txtOwner.Value &amp; "','" &amp; _ Me.txtEvent.Value &amp; "', '" &amp; _ Me.txtVersion.Value &amp; "','" &amp; _ Me.txtExpectedResult.Value &amp; "', '" &amp; _ Me.txtVariation.Value &amp; "', '" &amp; _ Me.txtStatus.Value &amp; "','" &amp; _ Me.txtHomeStore.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1," &amp; _ "Start2, Finish2, Store2 ) values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Sunday ','" &amp; _ Me.txtContSunStart1.Value &amp; "', '" &amp; _ Me.txtContSunFinish1.Value &amp; "','" &amp; _ Me.txtContSunStore1.Value &amp; "','" &amp; _ Me.txtContSunStart2.Value &amp; "', '" &amp; _ Me.txtContSunFinish2.Value &amp; "','" &amp; _ Me.txtContSunStore2.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1, " &amp; _ "Start2, Finish2, Store2 ) values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Monday ','" &amp; _ Me.txtContMonStart1.Value &amp; "', '" &amp; _ Me.txtContMonFinish1.Value &amp; "','" &amp; _ Me.txtContMonStore1.Value &amp; "','" &amp; _ Me.txtContMonStart2.Value &amp; "', '" &amp; _ Me.txtContMonFinish2.Value &amp; "','" &amp; _ Me.txtContMonStore2.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1," &amp; _ "Start2, Finish2, Store2 ) values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Tuesday','" &amp; _ Me.txtContTueStart1.Value &amp; "', '" &amp; _ Me.txtContTueFinish1.Value &amp; "','" &amp; _ Me.txtContTueStore1.Value &amp; "','" &amp; _ Me.txtContTueStart2.Value &amp; "', '" &amp; _ Me.txtContTueFinish2.Value &amp; "','" &amp; _ Me.txtContTueStore2.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1, " &amp; _ "Start2, Finish2, Store2 ) values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Wednesday','" &amp; _ Me.txtContWedStart1.Value &amp; "', '" &amp; _ Me.txtContWedFinish1.Value &amp; "','" &amp; _ Me.txtContWedStore1.Value &amp; "','" &amp; _ Me.txtContWedStart2.Value &amp; "', '" &amp; _ Me.txtContWedFinish2.Value &amp; "','" &amp; _ Me.txtContWedStore2.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1," &amp; _ "Start2, Finish2, Store2 ) values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Thursday','" &amp; _ Me.txtContThuStart1.Value &amp; "', '" &amp; _ Me.txtContThuFinish1.Value &amp; "','" &amp; _ Me.txtContThuStore1.Value &amp; "','" &amp; _ Me.txtContThuStart2.Value &amp; "', '" &amp; _ Me.txtContThuFinish2.Value &amp; "','" &amp; _ Me.txtContThuStore2.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1," &amp; _ "Start2, Finish2, Store2 )values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Friday','" &amp; _ Me.txtContFriStart1.Value &amp; "', '" &amp; _ Me.txtContFriFinish1.Value &amp; "','" &amp; _ Me.txtContFriStore1.Value &amp; "','" &amp; _ Me.txtContFriStart2.Value &amp; "', '" &amp; _ Me.txtContFriFinsh2.Value &amp; "','" &amp; _ Me.txtContFriStore2.Value &amp; "')") DoCmd.RunSQL ("insert into tblContract " &amp; _ "(Empid, testid, Day, Start1, Finish1, Store1," &amp; _ "Start2, Finish2, Store2 )values ('" &amp; _ Me.txtEmpNo.Value &amp; "','" &amp; _ Me.txtAutoNumber.Value &amp; "','Saturday','" &amp; _ Me.txtContSatStart1.Value &amp; "', '" &amp; _ Me.txtContSatFinish1.Value &amp; "','" &amp; _ Me.txtContSatiStore1.Value &amp; "','" &amp; _ Me.txtContSatStart2.Value &amp; "', '" &amp; _ Me.txtContSatFinish2.Value &amp; "','" &amp; _ Me.txtContSatStore2.Value &amp; "')") End Sub </code></pre> <p>First two queries works fine (i.e. till Sunday)</p> <p>But from Monday the execution breaks </p> <p>I checked all variable in the query , there is not nulls there </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload