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 : How can I update inventory quantities?Search Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC SQL Sample Scripts Forum

 New Topic 
 
 Post Reply 
[1]  
 How can I update inventory quantities? 
 Author   Message 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-02-25 20:33:59

Currently the inventory quantities in the ItemInventory table cannot be updated directly, you must do Inventory Adjustments to change stock levels.

This example creates one inventoryadjustment with three lines. Note the FQSaveToCache field, set to True except on the last one. Note: You must be in single user mode for this to work.

INSERT INTO "InventoryAdjustmentLine" ("AccountRefListID", "TxnDate", "RefNumber", "Memo", "InventoryAdjustmentLineItemRefListID", "InventoryAdjustmentLineQuantityAdjustmentNewQuantity", "FQSaveToCache") VALUES ('320000-933270542', {d'2003-12-15'}, '1', 'Memo 1', '160000-933272656', 200.0, 1)

INSERT INTO "InventoryAdjustmentLine" ("AccountRefListID", "TxnDate", "RefNumber", "Memo", "InventoryAdjustmentLineItemRefListID", "InventoryAdjustmentLineValueAdjustmentNewValue", "FQSaveToCache") VALUES ('10000-933270541', {d'2003-12-15'}, '1', 'Memo 2', '450000-1071511428', 100.0, 1)

INSERT INTO "InventoryAdjustmentLine" ("AccountRefListID", "TxnDate", "RefNumber", "Memo", "InventoryAdjustmentLineItemRefListID", "InventoryAdjustmentLineQuantityAdjustmentNewQuantity", "FQSaveToCache") VALUES ('10000-933270541', {d'2003-12-15'}, '1', 'Memo 3', '440001-1071511796', 30.0, 0)

 

  Top 
  Julie Alley 
  
 Group: Members 
 Posts: 18 
 Joined: 2006-09-27 
 Profile
 Posted : 2006-12-03 11:19:58
Do you know if this will be possible in new versions? 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-12-03 19:05:36
It's not a case of functionality, but an accounting requirement. However you can create new stock items and set the Quantity On Hand. See: How do I add a Inventory Item using QODBC?  

  Top 
  Julie Alley 
  
 Group: Members 
 Posts: 18 
 Joined: 2006-09-27 
 Profile
 Posted : 2006-12-05 02:20:50
I do not understand the difference between each line that is required for adjusting the quantity of one line item.

Would you be kind enough to detail your understanding of each line of code you are using so we can know the logic behind the three lines of code you are using in your example? 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2006-12-05 08:19:59

The example shows adjustments to three different stock items. For two of them (Memo 1 & 3) we have adjusted the quanitity on hand and for one we changed the value (Memo 2).

FQSaveToCache is set true (1) to cache the lines of the tranactions (the seperate insert statements) into a single transaction. The transaction gets written to QuickBooks when FQSaveToCache is False (0).

 

  Top 
  LisaB 
  
 Group: Members 
 Posts: 1 
 Joined: 2007-01-19 
 Profile
 Posted : 2007-01-19 09:26:48
Tom:

I tried to do run this query
INSERT INTO QODBC...InventoryAdjustmentLine (AccountRefListID, TxnDate, RefNumber, Memo, InventoryAdjustmentLineItemRefListID, InventoryAdjustmentLineQuantityAdjustmentNewQuantity, FQSaveToCache) VALUES ('280001-1168875887', '2007-01-18', '1', 'Sold', '30000-1169069894', 3.0, 0)

and received the following error

Server: Msg 7343, Level 16, State 2, Line 1
OLE DB provider 'MSDASQL' could not INSERT INTO table '[QODBC]...[InventoryAdjustmentLine]'.
[OLE/DB provider returned message: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IRowsetChange::InsertRow returned 0x80040e21:  The provider return DB_E_ERRORSOCCURRED, but none of the columns is in error status. Data status sent to the provider: [COLUMN_NAME=AccountRefListID STATUS=DBSTATUS_S_OK], [COLUMN_NAME=TxnDate STATUS=DBSTATUS_S_OK], [COLUMN_NAME=RefNumber STATUS=DBSTATUS_S_OK], [COLUMN_NAME=Memo STATUS=DBSTATUS_S_OK], ...

Please advise.

Thanks 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2007-01-19 09:53:00
Your syntax is incorrect for SQL Linked tables. Try looking at: How do I do INSERTs, UPDATEs and DELETEs using OPENQUERY with Linked MS SQL Servers?  

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to