Quickbooks SDK Part II

Part I: Introduction and Controlling Procedure
Part II: Creating the Quickbooks Queries
Part III: Filling Class Modules
Part IV: Writing to Worksheets

In Part I, I listed the entry point procedure that controls the flow. Once the connection to Quickbooks is made, I create XML requests for each query I want to run. I’m using the QBFC object model so I don’t have to put the XML together myself. For each query, I add the columns that I want. I found that bringing over the whole table takes significantly longer than if I limit the number of columns.

For the sales orders, I set the boolean to include line items. The line items are what contain the inventory item detail. Without the line items, I would just be getting sales order header type information which is of no use to me. The same goes for the purchase orders.

For the inventory (assemblies and raw materials), I filter the list to include only active inventory items. Items that aren’t bought or sold have been made inactive and I don’t need them. There are plenty of other filters that can be applied to inventory items, sales orders, or just about anything else you get from Quickbooks. The documentation for the SDK lists all the filters that can be applied. I could, for instance, only pull sales orders that were created in the last year.

To include columns, I “add” the field name to the IncludeRetElementList object. If I spell the field name wrong, it returns nothing; no error, it just ignores that column. Most fields are simple values, like TxnID is a String value. Some fields are structures within themselves. CustomerRef returns a reference to the customer from which you can get at other customer related properties. You can’t pull in just the customer name, though, you have to pull the whole CustomerRef structure.

Here are the four procedures that set up the queries (XML requests) that will be sent to Quickbooks:

<< Part I Part III >>

3 thoughts on “Quickbooks SDK Part II

  1. Hey Dick,

    I’ve not jumped into trying the beta of Excel 07 and I’ve not seen the new version of QuickBooks. My quick question is that can you still easily get reports into Excel as in previous versions of QB just by pushing the “Excel” button on the report toolbar?


  2. Mike: There’s still an Excel button in QB07 that pushes reports into Excel, but I don’t have the beta at work, so I don’t know if it will work with Excel 2007. My guess is that it won’t without a re-write, but Intuit won’t let that feature deprecate. Too many people use it, I’m sure.

  3. How i can list all the records(accounts) for different classes using the Query?
    For e.g. i have Class1 and Class2 in my QB, and i want to get data associated with Class1 using appropriate query.

    Waiting for response, thanks for your time.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.