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
|
|
Inventory Adjustments from MS Access |
Author |
Message |
|
Posted : 2008-05-30 00:31:08 |
I am trying to create inventory adjustments in MS Access (2003) for QB 2008. I have looked at the previous post "How do I do Inventory Adjustments" which gives a good example in the VB Demo but I am unable to get it to work in Access. I can do one line with the FQSavetoCache at 0 but if I try to do more than one line, all but the last having the FQSavetoCache as true, it does not work.
I have also tried going through the loop and then forcing a blank record to have the FWSavetoCache at 0.
Below is the code I am using (the qryGetUnpostedItems contains 4 records which have correct item #'s, acct #'s, etc).
I have attached the code to a button: Dim db As DAO.Database Dim rs As DAO.Recordset Dim strAcctRef As String Dim strItemNo As String Dim strJobNo As String Dim strQty As String Dim strSeqNo As String Dim strMemo As String Dim strSQL As String Dim strDate As String Dim strFQCache As Integer Dim strCount As Integer Dim strCounter As Integer Dim strRefNo As String Set db = CurrentDb Set rs = CurrentDb.OpenRecordset("qryGetUnpostedItems") DoCmd.SetWarnings False strCount = DCount("ItemNumber", "qryGetUnpostedItems") strCounter = 0 rs.MoveLast rs.MoveFirst Do While Not rs.EOF strCounter = strCounter + 1 strAcctRef = rs.Fields("AccountRef") strItemNo = rs.Fields("ItemNumber") strJobNo = rs.Fields("JobNumber") strQty = rs.Fields("Quantity") strSeqNo = rs.Fields("SeqNumber") strMemo = rs.Fields("Memo") strDate = rs.Fields("TxnDate") If strCounter = strCount Then strFQCache = 0 Else strFQCache = 1 End If strSQL = "INSERT INTO InventoryAdjustmentLine " _ & "(AccountRefListID," _ & "TxnDate," _ & "RefNumber," _ & "Memo," _ & "InventoryAdjustmentLineItemRefListID," _ & "CustomerRefListID," _ & "InventoryAdjustmentLineQuantityAdjustmentQuantityDifference," _ & "FQSavetoCache)" _ & " VALUES " _ & "('" & strAcctRef & "'," _ & "'" & strDate & "'," _ & "'" & strSeqNo & "'," _ & "'" & strMemo & "'," _ & "'" & strItemNo & "'," _ & "'" & strJobNo & "'," _ & "" & strQty & "," _ & "" & strFQCache & ")" DoCmd.RunSQL strSQL rs.MoveNext
Loop rs.Close db.Close DoCmd.SetWarnings True ______________________________
The error I am getting is:
Run-Time error 3155 ODBC --Insert on linked table 'InventoryAdjustmentLine' failed
Thanks for any help you can give. |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-05-30 08:04:58 |
I'll take a guess and say that you're using different CustomerRefListID values. Only one customer reference can be used within the one transaction. You need to use a different transactions for different customers. The inserts into InventoryAdjustmentLine create a InventoryAdjustment header. There can only be one value for any of the header columns.
|
|
|
|
|
Posted : 2008-06-05 04:55:25 |
Yes, I did have different customer references so I put in new TxnNumbers for each line. What I am trying to do is this: I have a customer who will be doing inventory adjustments on hand helds that will be downloaded into an Access database. Periodically, those adjustments will be imported/appended into QuickBooks. So, there will be numerous records with different customer references in each batch. Below I have sample code for just two lines (with the data manually entered, the actual code will be looping through a recordset). I am getting an "Error Parsing complete XML string" when I run this. Can you identify the issue? Thanks for all your help...
strSQL = "INSERT INTO InventoryAdjustmentLine " _ & "(TxnNumber," _ & "AccountRefListID," _ & "TxnDate," _ & "RefNumber," _ & "CustomerRefListID," _ & "Memo," _ & "InventoryAdjustmentLineItemRefListID," _ & "InventoryAdjustmentLineQuantityAdjustmentQuantityDifference," _ & "FQSavetoCache)" _ & " VALUES " _ & "('1793'," _ & "'1E0000-933270542'," _ & "'2008-06-04'," _ & "'1'," _ & "'800000D1-1182061396'," _ & "' '," _ & "'F0000-933272656'," _ & "5," _ & " 0)" strSQL2 = "INSERT INTO InventoryAdjustmentLine " _ & "(TxnNumber," _ & "AccountRefListID," _ & "TxnDate," _ & "RefNumber," _ & "CustomerRefListID," _ & "Memo," _ & "InventoryAdjustmentLineItemRefListID," _ & "InventoryAdjustmentLineQuantityAdjustmentQuantityDifference," _ & "FQSavetoCache)" _ & " VALUES " _ & "('1794'," _ & "'1E0000-933270542'," _ & "'2008-06-04'," _ & "'1'," _ & "'800000B9-1197733691'," _ & "' '," _ & "'450000-1071511428'," _ & "1," _ & "0)" DoCmd.RunSQL strSQL DoCmd.RunSQL strSQL2 |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-06-05 08:19:21 |
At a quick glance, TxnNumber is a number, not a string and the TxnDate value isn't formatted correctly:
strSQL = "INSERT INTO InventoryAdjustmentLine " _ & "(TxnNumber," _ & "AccountRefListID," _ & "TxnDate," _ & "RefNumber," _ & "CustomerRefListID," _ & "Memo," _ & "InventoryAdjustmentLineItemRefListID," _ & "InventoryAdjustmentLineQuantityAdjustmentQuantityDifference," _ & "FQSavetoCache)" _ & " VALUES " _ & "(1793," _ & "'1E0000-933270542'," _ & "{d'2008-06-04'}," _ & "'1'," _ & "'800000D1-1182061396'," _ & "' '," _ & "'F0000-933272656'," _ & "5," _ & " 0)" strSQL2 = "INSERT INTO InventoryAdjustmentLine " _ & "(TxnNumber," _ & "AccountRefListID," _ & "TxnDate," _ & "RefNumber," _ & "CustomerRefListID," _ & "Memo," _ & "InventoryAdjustmentLineItemRefListID," _ & "InventoryAdjustmentLineQuantityAdjustmentQuantityDifference," _ & "FQSavetoCache)" _ & " VALUES " _ & "(1794," _ & "'1E0000-933270542'," _ & "{d'2008-06-04'}," _ & "'1'," _ & "'800000B9-1197733691'," _ & "' '," _ & "'450000-1071511428'," _ & "1," _ & "0)" DoCmd.RunSQL strSQL DoCmd.RunSQL strSQL2
If & "{d'2008-06-04'}," _ doesn't work, try & "06/04/2008," _ or & "#06/04/2008#," _
and then check the bottom of the QODBC Messages Log in the QODBC Setup Screen Messages Tab to see what is actually being sent by MS Access and correct it. |
|
|
|
|