locked
need a second pair of eyes RRS feed

  • Question

  • I have the following code that inserts a record

                'insert into line item table
                strSQL = "Insert into [tblInvoiceLineItems] (InvoiceID, Quantity, QuantityUnit, AddtoInventory, other, "
                strSQL = strSQL & "InventoryItem, ProjecttoCharge, Code, InvoiceDescription, InvoiceDescription2, "
                strSQL = strSQL & "fund, department, account, perUnitAmount, InvenotryItemAdded) values ("
                strSQL = strSQL & Me.InvoiceID & ", " & Me.Quantity & ", " & Chr(34) & Nz(Me.QuantityUnit, " ") & Chr(34) & ", " & IIf(Me.AddToInventory = True, True, False)
                strSQL = strSQL & ", " & IIf(Me.chkOther = True, True, False) & ", " & Nz(Me.InventoryItem, 0) & ", " & Chr(34) & Nz(Me.ProjectToCharge, " ") & Chr(34) & ", "
                strSQL = strSQL & Chr(34) & Nz(Me.Code, " ") & Chr(34) & ", " & Chr(34) & Nz(Me.InvoiceDescription, " ") & Chr(34) & ", "
                strSQL = strSQL & Chr(34) & Nz(Me.InvoiceDescription2, " ") & Chr(34) & ", " & Me.Fund & ", " & Me.Department & ", "
                strSQL = strSQL & Chr(34) & Me.Account & Chr(34) & ", " & Me.PerUnitAmount & ", " & IIf(Me.InvenotryItemAdded = True, True, False) & ")"
               
                CurrentDb.Execute strSQL, dbFailOnError
                Me.frmInvoiceLineItemsListSubform.Requery
                chkInvoiceAmount (Me.InvoiceID)

    it is errorring on the execute statement with error 3134 "syntax error in insert into statement"

    this has been working fine for sometime (it is in the "else" portion of and if then statement)

    the resulting sql string that is built during execution that causes error is:

    Insert into [tblInvoiceLineItems] (InvoiceID, Quantity, QuantityUnit, AddtoInventory, other, InventoryItem, ProjecttoCharge, Code, InvoiceDescription, InvoiceDescription2, fund, department, account, perUnitAmount, InvenotryItemAdded) values (749, 1, "EA", False, False, , "PW", "", "TRF Auditor Wages", "", 2, 0, "0516-0000", 475.29, False)

    Thursday, January 20, 2011 5:46 PM

Answers

All replies