Here is my sample code for creating new invoices using vba:
Set oRecordset2 = CreateObject("ADODB.Recordset") oRecordset2.CursorLocation = adUseClient oRecordset2.Open "SELECT * FROM InvoiceLine WHERE customerreflistid = '" & CustListID & "'", oConnection, adOpenStatic, adLockOptimistic
oRecordset2.AddNew oRecordset2.Fields("CustomerRefListID").Value = CustListID oRecordset2.Fields("TemplateRefListID").Value = TemplateListID oRecordset2.Fields("TxnDate").Value = InvoiceShowDate oRecordset2.Fields("InvoiceLineServiceDate").Value = DateServiced oRecordset2.Fields("InvoiceLineItemRefListID").Value = ItemServiceListID oRecordset2.Fields("InvoiceLineQuantity").Value = LineCount oRecordset2.Fields("FQSaveToCache").Value = True oRecordset2.Update NewCounter = NewCounter + 1
When I hit the last column in the spreadsheet, I change the FQSaveToCache value to False to write the invoice. This is all done on the InvoiceLine table. I see the IsToBePrinted flag is in the Invoice table. How can I set this variable to true while creating the invoice? |