需要来自 QuickBooks QBFC13 的所有客户地址(具有唯一 ID)
Need all Customer Addresses (with unique IDs) from QuickBooks QBFC13
我有一个通过 QBFC13 连接到 QuickBooks 的应用程序,下载客户(仅姓名、ID 和一些其他详细信息)以及这些客户的所有已知地址。这一切似乎都工作得很好,除了没有 GUID 或我可以看到的其他唯一标识符来唯一标识地址。因此,例如,客户更改了 QuickBooks 中的地址,我需要知道在应用程序中更改了哪个地址。或者,我使用地址 ID 而不是 Addr1-5 的整个块将信息发送到 QuickBooks。我认为地址名称是唯一的,但它不是并且可以为空。关闭地址字段既不实用也没有帮助。
这个 GUID 甚至存在吗?我错过了一些非常简单的东西吗?有一个更好的方法吗? QB 文档太糟糕了!
用于获取客户及其地址的VBA如下(为清楚起见,截取了一些代码)。
Dim respType As IResponseType
Set respType = curResp.Type
If (respType.getValue = rtCustomerQueryRs) Then
Dim custList As ICustomerRetList
Set custList = curResp.Detail
Dim curCust As ICustomerRet
Dim i As Integer
Dim insSQL As String
For i = 0 To custList.Count - 1
insSQL = "INSERT INTO " & CustomerTableName _
& "(CustomerID, QBEditSequence, Name, PhoneNumber, EMailAddress) " _
& "VALUES " _
& "("
Set curCust = custList.GetAt(i)
If (curCust.Sublevel.getValue = 0) Then
insSQL = insSQL & "'" & curCust.ListID.getValue & "',"
insSQL = insSQL & "'" & curCust.EditSequence.getValue & "',"
insSQL = insSQL & "'" & Replace(curCust.Name.getValue, "'", "''") & "',"
If (Not curCust.Phone Is Nothing) Then
insSQL = insSQL & "'" & curCust.Phone.getValue & "',"
Else
insSQL = insSQL & "'',"
End If
If (Not curCust.Email Is Nothing) Then
insSQL = insSQL & "'" & curCust.Email.getValue & "');"
Else
insSQL = insSQL & "'');"
End If
accessDB.Execute insSQL
' Add Bill to address
If Not curCust.BillAddressBlock Is Nothing Then
If curCust.BillAddressBlock.Addr1 Is Nothing = False Then
rs.AddNew
rs!CustomerID = curCust.ListID.getValue
rs!AddressType = "B"
rs!Addr1 = curCust.BillAddressBlock.Addr1.getValue
If curCust.BillAddressBlock.Addr2 Is Nothing = False Then rs!Addr2 = curCust.BillAddressBlock.Addr2.getValue
If curCust.BillAddressBlock.Addr3 Is Nothing = False Then rs!Addr3 = curCust.BillAddressBlock.Addr3.getValue
If curCust.BillAddressBlock.Addr4 Is Nothing = False Then rs!Addr4 = curCust.BillAddressBlock.Addr4.getValue
If curCust.BillAddressBlock.Addr5 Is Nothing = False Then rs!Addr5 = curCust.BillAddressBlock.Addr5.getValue
rs.Update
End If
End If
' Add Shipping Addresses
Dim shpList As IShipToAddressList
Set shpList = curCust.ShipToAddressList
If Not shpList Is Nothing Then
Dim s As Integer
For s = 0 To shpList.Count - 1
Dim saddr As IShipToAddress
Set saddr = shpList.GetAt(s)
rs.AddNew
rs!CustomerID = curCust.ListID.getValue
rs!AddressType = "S"
rs!AddressName = saddr.Name.getValue
rs!IsDefault = saddr.DefaultShipTo.getValue
rs!Addr1 = saddr.Addr1.getValue
If saddr.Addr2 Is Nothing = False Then rs!Addr2 = saddr.Addr2.getValue
If saddr.Addr3 Is Nothing = False Then rs!Addr3 = saddr.Addr3.getValue
If saddr.Addr4 Is Nothing = False Then rs!Addr4 = saddr.Addr4.getValue
If saddr.Addr5 Is Nothing = False Then rs!Addr5 = saddr.Addr5.getValue
rs.Update
Next s
End If
End If
Next i
End If
End If
几年前使用过 qb 并回顾了那个时期的一些项目。请注意,这是由客户端中的 qb 报告编写器提取的,最有把握提供截断的记录。
没有预定义的全球唯一地址标识符作为特定地址的单个字段。 customer/vendor 名称对于它们各自的 bill-from/to、ship-from/to 是唯一的,但帐单地址可以与送货地址相同,其他公司可以并且确实使用相同的地址。
这实际上在几种类型的业务中很常见。
所以 bill from 1 对于供应商来说是唯一的 header/name 但地址字符串本身也可以出现在 bill from 2, bill from 3 through 5 之前移动到 bill from street, street 2, city, state, zip, country 和所有这些字段汇总起来创建一个长地址字符串,简单命名为 bill from.
遗憾的是,我只有 xlsxm 和 csv。无法再访问 qb,因此我无法深入了解实际提供有用信息的信息
我有一个通过 QBFC13 连接到 QuickBooks 的应用程序,下载客户(仅姓名、ID 和一些其他详细信息)以及这些客户的所有已知地址。这一切似乎都工作得很好,除了没有 GUID 或我可以看到的其他唯一标识符来唯一标识地址。因此,例如,客户更改了 QuickBooks 中的地址,我需要知道在应用程序中更改了哪个地址。或者,我使用地址 ID 而不是 Addr1-5 的整个块将信息发送到 QuickBooks。我认为地址名称是唯一的,但它不是并且可以为空。关闭地址字段既不实用也没有帮助。 这个 GUID 甚至存在吗?我错过了一些非常简单的东西吗?有一个更好的方法吗? QB 文档太糟糕了!
用于获取客户及其地址的VBA如下(为清楚起见,截取了一些代码)。
Dim respType As IResponseType
Set respType = curResp.Type
If (respType.getValue = rtCustomerQueryRs) Then
Dim custList As ICustomerRetList
Set custList = curResp.Detail
Dim curCust As ICustomerRet
Dim i As Integer
Dim insSQL As String
For i = 0 To custList.Count - 1
insSQL = "INSERT INTO " & CustomerTableName _
& "(CustomerID, QBEditSequence, Name, PhoneNumber, EMailAddress) " _
& "VALUES " _
& "("
Set curCust = custList.GetAt(i)
If (curCust.Sublevel.getValue = 0) Then
insSQL = insSQL & "'" & curCust.ListID.getValue & "',"
insSQL = insSQL & "'" & curCust.EditSequence.getValue & "',"
insSQL = insSQL & "'" & Replace(curCust.Name.getValue, "'", "''") & "',"
If (Not curCust.Phone Is Nothing) Then
insSQL = insSQL & "'" & curCust.Phone.getValue & "',"
Else
insSQL = insSQL & "'',"
End If
If (Not curCust.Email Is Nothing) Then
insSQL = insSQL & "'" & curCust.Email.getValue & "');"
Else
insSQL = insSQL & "'');"
End If
accessDB.Execute insSQL
' Add Bill to address
If Not curCust.BillAddressBlock Is Nothing Then
If curCust.BillAddressBlock.Addr1 Is Nothing = False Then
rs.AddNew
rs!CustomerID = curCust.ListID.getValue
rs!AddressType = "B"
rs!Addr1 = curCust.BillAddressBlock.Addr1.getValue
If curCust.BillAddressBlock.Addr2 Is Nothing = False Then rs!Addr2 = curCust.BillAddressBlock.Addr2.getValue
If curCust.BillAddressBlock.Addr3 Is Nothing = False Then rs!Addr3 = curCust.BillAddressBlock.Addr3.getValue
If curCust.BillAddressBlock.Addr4 Is Nothing = False Then rs!Addr4 = curCust.BillAddressBlock.Addr4.getValue
If curCust.BillAddressBlock.Addr5 Is Nothing = False Then rs!Addr5 = curCust.BillAddressBlock.Addr5.getValue
rs.Update
End If
End If
' Add Shipping Addresses
Dim shpList As IShipToAddressList
Set shpList = curCust.ShipToAddressList
If Not shpList Is Nothing Then
Dim s As Integer
For s = 0 To shpList.Count - 1
Dim saddr As IShipToAddress
Set saddr = shpList.GetAt(s)
rs.AddNew
rs!CustomerID = curCust.ListID.getValue
rs!AddressType = "S"
rs!AddressName = saddr.Name.getValue
rs!IsDefault = saddr.DefaultShipTo.getValue
rs!Addr1 = saddr.Addr1.getValue
If saddr.Addr2 Is Nothing = False Then rs!Addr2 = saddr.Addr2.getValue
If saddr.Addr3 Is Nothing = False Then rs!Addr3 = saddr.Addr3.getValue
If saddr.Addr4 Is Nothing = False Then rs!Addr4 = saddr.Addr4.getValue
If saddr.Addr5 Is Nothing = False Then rs!Addr5 = saddr.Addr5.getValue
rs.Update
Next s
End If
End If
Next i
End If
End If
几年前使用过 qb 并回顾了那个时期的一些项目。请注意,这是由客户端中的 qb 报告编写器提取的,最有把握提供截断的记录。
没有预定义的全球唯一地址标识符作为特定地址的单个字段。 customer/vendor 名称对于它们各自的 bill-from/to、ship-from/to 是唯一的,但帐单地址可以与送货地址相同,其他公司可以并且确实使用相同的地址。 这实际上在几种类型的业务中很常见。
所以 bill from 1 对于供应商来说是唯一的 header/name 但地址字符串本身也可以出现在 bill from 2, bill from 3 through 5 之前移动到 bill from street, street 2, city, state, zip, country 和所有这些字段汇总起来创建一个长地址字符串,简单命名为 bill from.
遗憾的是,我只有 xlsxm 和 csv。无法再访问 qb,因此我无法深入了解实际提供有用信息的信息