Hi,
I have made this sample, it's finding a match from another system to QuickBook, and I need to get the ListId, but when I make a debug.print, when I get a runtime error 3001.
Isen't it possible to make a loop where I get the listId?
SAMPLE:
Function test2()
Set myQBConn = CreateObject("ADODB.Connection") Set myQBRecordset = CreateObject("ADODB.Recordset") myQBConn.Open = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=QuickBooks Data;OLE DB Services=-2;"
Dim vDB As DAO.Database Dim RS As DAO.Recordset
Set vDB = CurrentDb vSQL = "SELECT Import_BCN.Customer_Name FROM Import_BCN GROUP BY Import_BCN.Customer_Name" Set RS = vDB.OpenRecordset(vSQL)
With RS Do Until .EOF Debug.Print .Fields(0) ' Find ID fra QuickBooks vCustomer = "Select ListId, FullName from Customer where FullName like '" & .Fields(0) & "%'" myQBConn.Execute vCustomer Debug.Print myQBConn.ListId .MoveNext Loop .Close End With
End Function |