Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Setting the Print Flag When Creating Invoice in Excel Using VBASearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Support Forum

 New Topic 
 
 Post Reply 
[1]  
 Setting the Print Flag When Creating Invoice in Excel Using VBA 
 Author   Message 
  johnbin 
  
 Group: Members 
 Posts: 29 
 Joined: 2007-08-18 
 Profile
 Posted : 2007-11-16 07:03:46

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?

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-11-16 15:43:24

Just add IsToBePrinted to your routine.

oRecordset2.AddNew
oRecordset2.Fields("CustomerRefListID").Value = CustListID
oRecordset2.Fields("TemplateRefListID").Value = TemplateListID
oRecordset2.Fields("TxnDate").Value = InvoiceShowDate
oRecordset2.Fields("InvoiceLineServiceDate").Value = DateServiced
oRecordset2.Fields("IsToBePrinted").Value = True
oRecordset2.Fields("InvoiceLineItemRefListID").Value = ItemServiceListID
oRecordset2.Fields("InvoiceLineQuantity").Value = LineCount
oRecordset2.Fields("FQSaveToCache").Value = True
oRecordset2.Update
NewCounter = NewCounter + 1

 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to