Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Method 'GetAt' of Object 'BlahBlahBlah' Failed"

Status
Not open for further replies.

bcogan6502

Programmer
Apr 3, 2011
3
US
I am trying to build 2 transaction tables based on an array that I loaded from two other arrays, so that both tables will contain the same information. While loading the first table everything seems find until the third iteration (i=2) when I am getting the "Method 'GetAt' of Object 'IORSalesOrderLineRetList' Failed". And I don't understand what is happening. There are 19 detail lines and I can only get through the first 2.The detail line is not blank, so I am really stumped here.

It is actually using Intuit SDK 8.0 to modify Sales Orders in QuickBooks Enterprise 11.0, using VBA in Access 2010. But I think the "Object Failed" has to do with Access and not the SDK.

The code is contained in the attached text file.

Please help. I am still fighting with this same program that I have been fighting with since March 19th and it was supposed to be delivered March 25th. I am closer, but still not finished.

 



Hi,

Please post your code.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
That is what is contaIned in the link. I don't like how it wraps in the post.
 


just copy 'n' paste!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I guess it doesn't lose my indentations and whatever. Here it is:

Dim SessionManager As QBSessionManager
Set SessionManager = New QBSessionManager
SessionManager.OpenConnection2 " ", "SFW Sales Order & Month-End", ctLocalQBD
SessionManager.BeginSession "", omDontCare

Dim requestMsgSet As IMsgSetRequest
Set requestMsgSet = SessionManager.CreateMsgSetRequest("US", 8, 0)
requestMsgSet.Attributes.OnError = roeStop

Dim SalesOrderQuery As ISalesOrderQuery
Set SalesOrderQuery = requestMsgSet.AppendSalesOrderQueryRq

SalesOrderQuery.IncludeRetElementList.Add TransID
SalesOrderQuery.IncludeRetElementList.Add EditSequence
SalesOrderQuery.ORTxnNoAccountQuery.TxnFilterNoAccount.ORRefNumberFilter.RefNumberRangeFilter.FromRefNumber.SetValue SalesOrderArray(0, 8)
SalesOrderQuery.IncludeLineItems.SetValue True

Dim responseMsgSet As IMsgSetResponse
Set responseMsgSet = SessionManager.DoRequests(requestMsgSet)
Dim response As IResponse

Set response = responseMsgSet.responseList.GetAt(0)

Dim SalesOrderRetList As ISalesOrderRetList
If response.Detail Is Nothing Then
MsgBox "No Detail available"
Exit Sub
End If
Set SalesOrderRetList = response.Detail

Dim SalesOrderRet As ISalesOrderRet
Set SalesOrderRet = SalesOrderRetList.GetAt(0)

Dim TxnID As String
TxnID = SalesOrderRet.TxnID.GetValue

Set response = responseMsgSet.responseList.GetAt(0)
If response.Detail Is Nothing Then
MsgBox "No Detail available"
Exit Sub
End If

Set SalesOrderRetList = response.Detail

Set SalesOrderRet = SalesOrderRetList.GetAt(0)
requestMsgSet.ClearRequests

Dim SalesOrderMod As ISalesOrderMod
Set SalesOrderMod = requestMsgSet.AppendSalesOrderModRq
SalesOrderMod.TxnID.SetValue SalesOrderRet.TxnID.GetValue
SalesOrderMod.EditSequence.SetValue SalesOrderRet.EditSequence.GetValue

Dim SalesOrderModLine As ISalesOrderLineMod
Dim SalesOrderRetLine As IORSalesOrderLineRet
Dim i As Integer

For i = 0 To SalesOrderIndex - 1
If Not SalesOrderRet.ORSalesOrderLineRetList.GetAt(i).SalesOrderLineRet Is Nothing Then
'-------Line that is causing error is above this line - SalesOrderIndex is number of detail lines in table

Set SalesOrderRetLine = SalesOrderRet.ORSalesOrderLineRetList.GetAt(i)
End If
Set SalesOrderModLine = SalesOrderMod.ORSalesOrderLineModList.Append.SalesOrderLineMod
SalesOrderModLine.TxnLineID.SetValue SalesOrderRetLine.SalesOrderLineRet.TxnLineID.GetValue
If Len(NewDetailLine(i, 0)) > 0 Then
SalesOrderModLine.ItemRef.FullName.SetValue NewDetailLine(x, 0)
End If
If Len(NewDetailLine(i, 1)) > 0 Then
SalesOrderModLine.Desc.SetValue NewDetailLine(i, 1)
End If
If Len(NewDetailLine(i, 2)) > 0 Then
SalesOrderModLine.Other1.SetValue NewDetailLine(i, 2)
End If
If Len(NewDetailLine(i, 3)) > 0 Then
SalesOrderModLine.Quantity.SetValue NewDetailLine(i, 3)
End If
If Len(NewDetailLine(i, 4)) > 0 Then
SalesOrderModLine.Amount.SetValue NewDetailLine(i, 4)
End If
If Len(NewDetailLine(i, 5)) > 0 Then
SalesOrderModLine.ClassRef.FullName.SetValue NewDetailLine(i, 5)
End If
If Len(NewDetailLine(i, 6)) > 0 Then
SalesOrderModLine.SalesTaxCodeRef.FullName.SetValue NewDetailLine(i, 6)
End If
Next i

Set responseMsgSet = SessionManager.DoRequests(requestMsgSet)
 


Code:
   Dim response As IResponse

   Set response = responseMsgSet.responseList.GetAt(0)

FIRST, I don't have that library loaded, so I do not know if GetAt, Get Attribute, is a member of that library. I know that it ia a member of the VBA FileSystem library.

SECOND, does that object return an IResponse object.

YOU can answer both of those questions yourself, using the Object Browser and/or the Watch Window. faq707-4594

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top