I'm trying to hammer through the below, not knowing VB. It's not likely I will find someone here knowing both MS Access VB and Quickbooks SDK.
This line is in error: Set query = msgReq.AppendInvoiceQueryRq.ORInvoiceQuery.RefNumb erList.GetAt
Compile Error: Argument not optional.
What kind of argument is expected for GetAt? What does GetAt even mean?
Code:
Private Sub InvNo()
Dim accessDB As Database
Set accessDB = CurrentDb
If (accessDB Is Nothing) Then
Exit Sub
End If
Dim SessMgr As New QBSessionManager
SessMgr.OpenConnection "", "Highest InvNo"
SessMgr.BeginSession "", omDontCare
Dim msgReq As IMsgSetRequest
Set msgReq = SessMgr.CreateMsgSetRequest("US", 13, 0)
Dim query As IInvoiceQuery
Set query = msgReq.AppendInvoiceQueryRq.ORInvoiceQuery.RefNumberList.GetAt
query.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.FromTxnDate.SetValue ("2019-08-01")
query.ORInvoiceQuery.InvoiceFilter.ORDateRangeFilter.TxnDateRangeFilter.ORTxnDateRangeFilter.TxnDateFilter.ToTxnDate.SetValue ("2019-08-10")
Dim resp As IMsgSetResponse
Set resp = SessMgr.DoRequests(msgReq)
Dim respList As IResponseList
Set respList = resp.ResponseList
Dim curResp As IResponse
Set curResp = respList.GetAt(0)
If (curResp.statusCode = 0) Then
Dim respType As IResponseType
Set respType = curResp.Type
If (respType.GetValue = rtInvoiceQueryRs) Then
Dim custList As IInvoiceRetList
Set custList = curResp.Detail
Dim curCust As IInvoiceRet
Dim i As Integer
Dim insSQL As String
For i = 0 To custList.Count - 1
insSQL = "INSERT INTO Customers " _
& "(InvNo) " _
& "VALUES " _
& "("
Set curCust = custList.GetAt(i)
If (curCust.Sublevel.GetValue = 0) Then
insSQL = insSQL & "'" & curCust.RefNumber.GetValue & "',"
accessDB.Execute insSQL
End If
Next i
End If
End If
SessMgr.EndSession
SessMgr.CloseConnection
Set SessMgr = Nothing
End Sub
thanks!